[Pkg-javascript-commits] [dojo] 11/13: Just use onfocusin as a detection test for focusin support

David Prévot taffit at moszumanska.debian.org
Thu Aug 21 17:39:57 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to annotated tag 1.9.3
in repository dojo.

commit df47713a809bb5dfdd9a6dad472b6693c501b866
Author: Colin Snover <github.com at zetafleet.com>
Date:   Fri Feb 14 19:08:34 2014 +0000

    Just use onfocusin as a detection test for focusin support
    
    Due to various restrictions on what dojo/on can depend on,
    and a desire to resolve this issue so that a release can be issued,
    simply check for a matching event key on the has-test element.
    This stops focusin/focusout from being used in WebKit and Blink
    in lieu of event capturing, which is not ideal, but is not any
    worse than what was happening before.
    
    Refs #17599.
    
    (cherry picked from commit 81e1c7d6b52e2f42a3bbc8259f875bd83aaa8541)
---
 on.js | 22 +---------------------
 1 file changed, 1 insertion(+), 21 deletions(-)

diff --git a/on.js b/on.js
index 3b2aeb5..0790608 100644
--- a/on.js
+++ b/on.js
@@ -7,27 +7,7 @@ define(["./has!dom-addeventlistener?:./aspect", "./_base/kernel", "./sniff"], fu
 		has.add("event-orientationchange", has("touch") && !has("android")); // TODO: how do we detect this?
 		has.add("event-stopimmediatepropagation", window.Event && !!window.Event.prototype && !!window.Event.prototype.stopImmediatePropagation);
 		has.add("event-focusin", function(global, doc, element){
-			return 'onfocusin' in element || (element.addEventListener && (function () {
-				var hasFocusInEvent = false;
-				function testFocus() {
-					hasFocusInEvent = true;
-				}
-
-				try {
-					var element = doc.createElement('input'),
-						activeElement = doc.activeElement;
-					element.style.position = 'fixed';
-					element.style.top = element.style.left = '0';
-					element.addEventListener('focusin', testFocus, false);
-					doc.body.appendChild(element);
-					element.focus();
-					doc.body.removeChild(element);
-					element.removeEventListener('focusin', testFocus, false);
-					activeElement.focus();
-				} catch (e) {}
-
-				return hasFocusInEvent;
-			})());
+			return 'onfocusin' in element;
 		});
 	}
 	var on = function(target, type, listener, dontFix){

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/dojo.git



More information about the Pkg-javascript-commits mailing list