Opened 13 years ago

Closed 10 years ago

#8451 closed enhancement (wontfix)

NodeList trigger event capabilities

Reported by: dante Owned by: Kris Zyp
Priority: low Milestone: tbd
Component: Core Version: 1.2.3
Keywords: needsreview Cc:
Blocked By: Blocking:


There is a FIXME at the bottom of NodeList.js which looks to attempt to implement something like:


which will trigger any attached click events for the matched nodes (null callback triggers, passing function would register)

There are probably some technical issues as to why this is not active code, but I'm making this ticket to expose (or rehash?) that discussion.

+1 for the feature from me, but it looks like the implementation is incomplete? Instead of looking for callbacks attached, couldn't we synthesize a dom event originating at the node and just let the browser fire them naturally?

Change History (5)

comment:1 Changed 13 years ago by James Burke

In trying to do this for the jquery compat module, it seems a bit involved: I am not sure I have it down quite correctly, but it seems like in some (most?) cases triggering the event handlers by calling a method on the dom node does not work. It can be simulated though if you have a list of connects on a node.

I could be missing something though, and I would be glad to be shown the light. But if not, then this might also argue for tracking connects per dom node, iirc, something like what we did back in 0.4?

comment:2 Changed 11 years ago by Chris Mitchell

Owner: changed from alex to dylan

please review/triage

comment:3 Changed 10 years ago by ben hockey

Keywords: needsreview added
Priority: highlow

comment:4 Changed 10 years ago by bill

Milestone: futuretbd
Owner: changed from dylan to Kris Zyp
Status: newassigned

Now that we have dojo/on with it's emit() function, this is presumably just a few lines of code. OTOH, it doesn't seem like a terribly common operation, and user can already do it today via:

myNodeList.forEach(function(node){  on.emit(node, "click", {bubbles: true}); });

FYI, I don't see that FIXME at the bottom of NodeList anymore.

comment:5 Changed 10 years ago by Kris Zyp

Resolution: wontfix
Status: assignedclosed

I would agree that this does not seem like a very common operation, and can now easily be done with a forEach and on.emit.

Note: See TracTickets for help on using tickets.