event-propagation

How do you stop children from propagating an event triggered by a live/delegate listener?

筅森魡賤 提交于 2019-12-07 13:22:49
问题 I have a delegation parent that listen for click events in a set of children with a specific class. $(".toggle_group").on("click",".toggle",function(e){ .. }); so heres an example of the html <div class='toggle_group'> <a class='toggle'>click me and i toggle <div>Im a child of toggle</div></a> <a class='toggle'>click me and i toggle <div>Im a child of toggle</div></a> <a class='toggle'>click me and i toggle <div>Im a child of toggle</div></a> <a class='toggle'>click me and i toggle <div>Im a

How do you stop children from propagating an event triggered by a live/delegate listener?

拈花ヽ惹草 提交于 2019-12-06 02:19:47
I have a delegation parent that listen for click events in a set of children with a specific class. $(".toggle_group").on("click",".toggle",function(e){ .. }); so heres an example of the html <div class='toggle_group'> <a class='toggle'>click me and i toggle <div>Im a child of toggle</div></a> <a class='toggle'>click me and i toggle <div>Im a child of toggle</div></a> <a class='toggle'>click me and i toggle <div>Im a child of toggle</div></a> <a class='toggle'>click me and i toggle <div>Im a child of toggle</div></a> </div> the problem is that children of a.toggle propogate the event to the

Real world example where event capturing is necessary / preferred?

依然范特西╮ 提交于 2019-12-05 14:15:30
The addEventListener DOM method supports a third optional, boolean parameter (useCapture) to indicate whether the function should use event bubbling or event capturing as propagation method. In this article the difference is nicely shown (click on the examples & view code). From other questions on SO and blog posts, I concluded event bubbling was preferred mostly because IE8- didn't support it. Suppose I'm only required to support IE9+, in what situation would event capturing be necessary or preferred over event bubbling? In other words, in what situation would it be better to let the events

How can I bubble up an Ember action inside a callback function?

一曲冷凌霜 提交于 2019-12-05 00:20:30
问题 I have an Ember application and I am using an action to apply a CSS animation. Once the animation is complete I want to bubble up the action from the controller to my route to handle further functionality. I know that if I return: true; the action will bubble up, as explained here. This is what my controller looks like: App.MyController = Ember.ObjectController.extend({ actions: { myAction: function() { $('.my-element').addClass('my-animation-class').one('webkitAnimationEnd oanimationend

Does stopPropgation stop the event from propagating in the capture phase?

吃可爱长大的小学妹 提交于 2019-12-04 17:29:34
问题 I was looking at http://www.quirksmode.org/js/events_order.html and it is ambiguous in this part: In the Microsoft model you must set the event’s cancelBubble property to true . window.event.cancelBubble = true In the W3C model you must call the event’s stopPropagation() method. e.stopPropagation() This stops all propagation of the event in the bubbling phase. So my question is: When an event listener is set to listen in the capture phase, does it automatically not continue propagating to the

Problems with using shortcuts in Vaadin

江枫思渺然 提交于 2019-12-04 17:00:48
I have some problems with shortcuts in Table. I have to customize some keys: delete - for removing the rows and enter to make table editable/uneditable, up/down arrows to switch mode of table from editable to uneditable. I put my Table inside transparent Panel and use Action.Handler to catch keyboard events. But when I'm writing inside TextField, TextArea, Combobox I wanted to propagate events to this component (handling delete key disable using it for deleting text in TextField and up/down keys doesn't allow open Combobox with keyboard). I saw target parameter in handleAction() method, but I

Excluding form fields from keypress handler assigned to body

陌路散爱 提交于 2019-12-04 04:27:21
问题 I have a keypress handler on a web page assigned to the body element. I really do want it to be active anywhere in the web page. Or so I thought. The keypress events in textual input forms also activate the body handler, which makes sense, but which I don't want. Ideally, I'd like to keep the keypress handler assigned to the body element and somehow exclude just the input forms. Is there any way I can stop the event at the input level and prevent it from propagating to body? (Or is that even

How can I bubble up an Ember action inside a callback function?

丶灬走出姿态 提交于 2019-12-03 16:40:11
I have an Ember application and I am using an action to apply a CSS animation. Once the animation is complete I want to bubble up the action from the controller to my route to handle further functionality. I know that if I return: true; the action will bubble up, as explained here . This is what my controller looks like: App.MyController = Ember.ObjectController.extend({ actions: { myAction: function() { $('.my-element').addClass('my-animation-class').one('webkitAnimationEnd oanimationend msAnimationEnd animationend', function(e) { console.log('working'); return true; } } } }); If I log

Javascript/jquery, get all divs location at (x,y). Forwarding touches? [duplicate]

半世苍凉 提交于 2019-12-03 13:44:32
Possible Duplicate: How to get a list of all elements that resides at the clicked point? I know I can get the element with the highest z-index by using document.elementFromPoint(x,y) . The problem is I need to get every div that contains the touch event's location. How can I propagate touches to elements underneath? I have seen some hacky solutions that show/hide elements while re-generating the event, or pointer-events style with css, however I cannot use these and they may cause flickering... The following diagram illustrates what I need to do: If the purple, green, and blue boxes represent

Does stopPropgation stop the event from propagating in the capture phase?

≡放荡痞女 提交于 2019-12-03 10:33:54
I was looking at http://www.quirksmode.org/js/events_order.html and it is ambiguous in this part: In the Microsoft model you must set the event’s cancelBubble property to true . window.event.cancelBubble = true In the W3C model you must call the event’s stopPropagation() method. e.stopPropagation() This stops all propagation of the event in the bubbling phase. So my question is: When an event listener is set to listen in the capture phase, does it automatically not continue propagating to the inner elements? Or if it does continue propagating, does calling e.stopPropagation() stop it, or does