What is the thinking/philosophy behind having tunneling before Bubbling and not viceversa .
From stackoverflow
AB
-
This gives the container, for example, the power to see an event before its children. This is useful in many cases, as e.g. disabling children, hover animations, drag'n'drop, selecting a parent container before continuing checking/clicking the child widget etc.
In other words, IMO it's easier to create a new container for a custom UI behavior and preview the events (tunneling) that go to stock widgets, than to create custom widgets and using a stock container (bubbling).
AB : Dont feel 100% with the container example taking an example I understand :) , if i have an image on a button , wouldnt i want the button to get the mousedownevent for click processing rather than the other way ? so button been composed of image bubbling should be first rather than tunneling On similar lines when would tunneling make sense before bubblingVlagged : If you have an image within a button and you click in the image area, the button will receive the tunneled event first ('PreviewMouseDown'), while the image will receive the bubbled event first. Since tunneling occurs before bubbling, you just need to implement the handler on the button, regardless of its content.From Vlagged -
Tunneling is before bubbeling because event handlers are in the element tree root.
This is well explained here in "Routing strategies"
AB : thanks for the doc mate , was helpfulFrom rockeye
0 comments:
Post a Comment