问题
I found out that certain events on the video/audio tag don't bubble (loadedmetadata, progress, etc). Is this against the standard or is it common for other events?
How am I supposed to know what events are supposed to bubble or not bubble?
回答1:
- You can test it...
readonly attribute boolean bubbles;
check this property of the event.
bubbles of type boolean, readonly
Used to indicate whether or not an event is a bubbling event. If the event can bubble the value is true, else the value is false.
w3 source not w3School... :)
回答2:
Bubbling events are usually those that need to bubble. Like if you click an element, you are also clicking its parents so it must bubble. But when a progress happens on a media element, it doesn't really happen on its parents the way keyup, click, mouseover etc do.
回答3:
Look in the specs. gdoron already posted a link to them and explained the each Event
has an attribute indicating whether it bubbles or not - only useful when you have the event already.
Yet, look further down in that spec: In the Event module definitions there is an overview of events and whether they bubble or not. Also, you will finde more events in the DOM-Level3-Draft.
Also, you asked progress events. They are only a draft, but in the section about proposed events you can find that they are not supposed to bubble.
来源:https://stackoverflow.com/questions/10576167/js-events-that-dont-bubble-progress-loadedmetadata-etc