[Pkg-javascript-commits] [dojo] 14/28: Use IE's native focusin/focusout support for IE9+ too, avoiding asynchronous focus notification, fixes #16968, #16970, and refs #16926, #16972 !strict.

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


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

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

commit b9ab7f580c8a123ff07ebd9a3b0695e24cf5c5ba
Author: Bill Keese <bill at dojotoolkit.org>
Date:   Tue Dec 31 15:31:40 2013 -0500

    Use IE's native focusin/focusout support for IE9+ too, avoiding asynchronous focus notification, fixes #16968,  #16970, and refs #16926, #16972 !strict.
    
    git-svn-id: http://svn.dojotoolkit.org/src/dojo/trunk@31152 560b804f-0ae3-0310-86f3-f6aa0a117693
    (cherry picked from commit 74f1af634dff02139086221b69b6066c34546e18)
    
    Conflicts:
    	on.js
---
 on.js | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/on.js b/on.js
index c01c1f9..2808769 100644
--- a/on.js
+++ b/on.js
@@ -6,6 +6,11 @@ define(["./has!dom-addeventlistener?:./aspect", "./_base/kernel", "./has"], func
 		has.add("jscript", major && (major() + ScriptEngineMinorVersion() / 10));
 		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){
+			// All browsers except firefox support focusin, but too hard to feature test webkit since element.onfocusin
+			// is undefined.  Just return true for IE and use fallback path for other browsers.
+			return !!element.attachEvent;
+		});
 	}
 	var on = function(target, type, listener, dontFix){
 		// summary:
@@ -276,7 +281,7 @@ define(["./has!dom-addeventlistener?:./aspect", "./_base/kernel", "./has"], func
 		}while(event && event.bubbles && (target = target.parentNode));
 		return event && event.cancelable && event; // if it is still true (was cancelable and was cancelled), return the event to indicate default action should happen
 	};
-	var captures = {};
+	var captures = has("event-focusin") ? {} : {focusin: "focus", focusout: "blur"};
 	if(!has("event-stopimmediatepropagation")){
 		var stopImmediatePropagation =function(){
 			this.immediatelyStopped = true;
@@ -292,12 +297,6 @@ define(["./has!dom-addeventlistener?:./aspect", "./_base/kernel", "./has"], func
 		}
 	} 
 	if(has("dom-addeventlistener")){
-		// normalize focusin and focusout
-		captures = {
-			focusin: "focus",
-			focusout: "blur"
-		};
-
 		// emiter that works with native event handling
 		on.emit = function(target, type, event){
 			if(target.dispatchEvent && document.createEvent){

-- 
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