[Pkg-javascript-commits] [dojo] 65/149: fixes #18608, allow on/asyncEventListener to work in Android and Node

David Prévot taffit at moszumanska.debian.org
Sat Feb 27 03:13:48 UTC 2016


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

taffit pushed a commit to branch master
in repository dojo.

commit 31a8ad6afbc296532110e3312fdefb29174ed49c
Author: Benjamin Santalucia <ben at dojotoolkit-fr.org>
Date:   Fri Jul 3 04:39:14 2015 -0700

    fixes #18608, allow on/asyncEventListener to work in Android and Node
---
 on/asyncEventListener.js | 30 +++++++++++++++++-------------
 1 file changed, 17 insertions(+), 13 deletions(-)

diff --git a/on/asyncEventListener.js b/on/asyncEventListener.js
index cf48efa..72ee548 100644
--- a/on/asyncEventListener.js
+++ b/on/asyncEventListener.js
@@ -1,4 +1,4 @@
-define(['../on', '../_base/window', '../dom-construct', '../domReady!'], function(on, baseWin, domConstruct){
+define(['../on', '../has', '../_base/window', 'dojo/has!host-browser?../dom-construct', 'dojo/has!host-browser?../domReady!'], function(on, has, baseWin, domConstruct){
 	// summary:
 	//		This sub module provide an event factory for delayed events (like debounce or throttle)
 	// module:
@@ -8,20 +8,24 @@ define(['../on', '../_base/window', '../dom-construct', '../domReady!'], functio
 	//Testing is the browser support async event access
 	//If not we need to clone the event, otherwise accessing the event properties
 	//will trigger a JS error (invalid member)
-	var testNode = domConstruct.create('div', null, baseWin.body()),
+	var testNode,
 		testEvent,
-		requiresClone;
-	on.once(testNode, 'click', function(e){
-		testEvent = e;
-	});
-	testNode.click();
-	try{
-		requiresClone = testEvent.clientX === undefined;
-	}catch(e){
-		requiresClone = true;
-	}finally{
-		domConstruct.destroy(testNode);
+		requiresClone = false;
+	if(domConstruct) {
+		testNode = domConstruct.create('input', {type: 'button'}, baseWin.body()),
+		on.once(testNode, 'click', function(e){
+			testEvent = e;
+		});
+		testNode.click();
+		try{
+			requiresClone = testEvent.clientX === undefined;
+		}catch(e){
+			requiresClone = true;
+		}finally{
+			domConstruct.destroy(testNode);
+		}
 	}
+	has.add('native-async-event-support', !requiresClone);
 
 	function clone(arg){
 		// summary:

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