Opened 7 years ago

Closed 7 years ago

#16004 closed enhancement (duplicate)

dojo.on() function accidentally calls jQuery when a node is decorated by jQuery.on()

Reported by: ffan Owned by: Kris Zyp
Priority: undecided Milestone: tbd
Component: Events Version: 1.8.0
Keywords: Cc:
Blocked By: Blocking:

Description

I'm using the dojo1.8.0 release. Our project uses both dojo and jQuery(1.5.2). I found that the dojo.on() function somehow calls into JQuery if jQuery already added an 'on()' function to the DOM node

  --for example: line 17392 of dojo.js.uncompressed.js
    if jQuery has installed on() function on the object node, dojo.on() will
    call that jQuery function --
  var keydownSignal = on(object, "keydown", function(evt){
    ...
  }

I file this as an enhancement as I always believe dojo is better than jQuery.

Change History (3)

comment:1 Changed 7 years ago by ffan

Actually the true problem is that the handler returned by jQuery.on() doesn't provide 'remove' attribute and it would cause problem when dijit.popup is closed. So I'm wondering if dojo can add a 'remove' attribute to user defined handlers. For example:

	var on = function(target, type, listener, dontFix){
		if(target.on && typeof type != "function"){ 
			// delegate to the target's on() method, so it can handle it's own listening if it wants
			var h = target.on(type, listener);
			console.debug('onhandler', h);
			if ( ! ('remove' in h ) ){
			  h.remove = function(){
			    if ( target.off ){
			      target.off(type, listener);
			    }
			  }
			}
			return h;
		}
                ...

comment:2 Changed 7 years ago by bill

Component: CoreEvents
Owner: set to Kris Zyp

comment:3 Changed 7 years ago by bill

Resolution: duplicate
Status: newclosed

Duplicate of #15862.

Note: See TracTickets for help on using tickets.