[Pkg-javascript-commits] [dojo] 09/21: Refs #18168. dojo/on: adjust feature detection such that it also works in iOS 8 (beta) with a built dojo/on stripping the strict mode

David Prévot taffit at moszumanska.debian.org
Sun Sep 14 15:39:21 UTC 2014


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

taffit pushed a commit to branch master
in repository dojo.

commit 8bc5e8ca2f646c30edc6ed9bf1cc997c535772f9
Author: Adrian Vasiliu <vasiliu at fr.ibm.com>
Date:   Fri Aug 29 14:11:45 2014 +0200

    Refs #18168. dojo/on: adjust feature detection such that it also works in iOS 8 (beta) with a built dojo/on stripping the strict mode
---
 on.js | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/on.js b/on.js
index 419ff24..ef42cb6 100644
--- a/on.js
+++ b/on.js
@@ -19,10 +19,15 @@ define(["./has!dom-addeventlistener?:./aspect", "./_base/kernel", "./sniff"], fu
 				var EventDelegate = function(){};
 				EventDelegate.prototype =
 					document.createEvent("MouseEvents"); // original event
+				// Attempt to modify a property of an event delegate and check if
+				// it succeeds. Depending on browsers and on whether dojo/on's
+				// strict mode is stripped in a Dojo build, there are 3 known behaviors:
+				// it may either succeed, or raise an error, or fail to set the property
+				// without raising an error.
 				try{
-					// Attempt to modify a property of an event delegate:
-					(new EventDelegate).target = null;
-					return true; // can use event delegation
+					var eventDelegate = new EventDelegate;
+					eventDelegate.target = null;
+					return eventDelegate.target === null;
 				}catch(e){
 					return false; // cannot use event delegation
 				}

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