Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

dojo/on: added on.handleError for addListener

  • Loading branch information...
commit a4b672a4cf847796e7c4cece999d03fcf964df16 1 parent bcdbeab
@miksago miksago authored
Showing with 11 additions and 1 deletion.
  1. +11 −1 on.js
View
12 on.js
@@ -105,7 +105,17 @@ define(["./has!dom-addeventlistener?:./aspect", "./_base/kernel", "./has"], func
return addListener(target, type, listener, dontFix, matchesTarget);
};
var touchEvents = /^touch/;
- function addListener(target, type, listener, dontFix, matchesTarget){
+ function addListener(target, type, _listener, dontFix, matchesTarget){
+ var listener = _listener;
+ if(typeof on.handleError === "function"){
+ listener = function(){
+ try{
+ return _listener.apply(this, arguments);
+ }catch(err){
+ on.handleError(err);
+ }
+ };
+ }
// event delegation:
var selector = type.match(/(.*):(.*)/);
// if we have a selector:event, the last one is interpreted as an event, and we use event delegation
Please sign in to comment.
Something went wrong with that request. Please try again.