-
Notifications
You must be signed in to change notification settings - Fork 27.5k
Bubbling browserTrigger() event #5178
Comments
I did a simple working bubbling example But if I run it as a test, the bubbling isn't happening:
|
Native bubbling does not work on detached DOM in some browsers. So element.dispatchEven(env) might not bubble in this case. Things like jquery.trigger() manually compute the parents and iterate over each one, triggering handlers in turn. You can either try to replicate the jquery behavior, or attach the dom somewhere (maybe just some hidden div at the end of the document). |
@dtabuenc I was suspecting that has something to do with the detached DOM but couldn't find any documentation that talks about this, did you find that somewhere? I was also trying to replicate Anyway, when testing bubbling I guess attaching to document might be the workaround for now or maybe just replicating |
Hi @dimirc - thanks for creating this issue and looking into the problem. With all this in mind, as it is currently working as we need it to for our purposes, we are not going to be able to assign time to improving it. I suggest that you either try the workaround of attaching the elements to the document, or perhaps loading up jQuery and using |
In some browsers, events don't bubble when they are dispatched on node inside a detached tree. When this is the case, the bubbling is made manually. This may be convenient when unit testing directives, for example. Closes #5178
In some browsers, events don't bubble when they are dispatched on node inside a detached tree. When this is the case, the bubbling is made manually. This may be convenient when unit testing directives, for example. Closes #5178
I'm trying to use
browserTrigger()
on an element and need the event on to bubble up to its ancestors, but the handler from the element (ancestor) isn't firingThis is a simple example of what I'm trying to do:
The
catchMe()
event (div's click handler) isn't getting fired.I checked the code from browserTrigger and the event that is pass to
element.dispatchEvent(env)
is withcanBubble : true
, so I don't get why it isn't bubbling...The text was updated successfully, but these errors were encountered: