[Pkg-javascript-commits] [dojo] 15/21: Correct detection of focusin support
David Prévot
taffit at moszumanska.debian.org
Thu Aug 21 17:39:54 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to annotated tag 1.9.2
in repository dojo.
commit ca391f932e3a3f032dd8b84566c4176857eb8ac3
Author: Colin Snover <github.com at zetafleet.com>
Date: Fri Nov 29 21:10:53 2013 +0000
Correct detection of focusin support
Fixes #17599
(cherry picked from commit e245ce5c80b85351642fd1ffc18a2d77bbbb0770)
---
on.js | 23 ++++++++++++++++++++---
1 file changed, 20 insertions(+), 3 deletions(-)
diff --git a/on.js b/on.js
index 15bb4b2..f4b97cc 100644
--- a/on.js
+++ b/on.js
@@ -7,9 +7,26 @@ 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){
- // 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;
+ return 'onfocusin' in element || (element.addEventListener && (function () {
+ var hasFocusInEvent = false;
+ function testFocus() {
+ hasFocusInEvent = true;
+ }
+
+ try {
+ var element = doc.createElement('input'),
+ style = element.style;
+ style.position = 'absolute';
+ 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);
+ } catch (e) {}
+
+ return hasFocusInEvent;
+ })());
});
}
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