[thelist] Event capturing and bubbling

Peter-Paul Koch gassinaumasis at hotmail.com
Mon Feb 11 06:05:00 CST 2002


>assuming you're asking if event-bubbling is of any use, a small example
>would be when dragging an object, you could put the onmousemove and
>onmouseup eventlisteners on the document, and they'd bubble through the
>object while dragging. This would make for a more modular drag-code in some
>circumstances.

Yes, of course. I've used this myself so I should have remembered. It will
definitely have to go into my article.

So let me rephrase my question: Does anyone know any example of a script
where an event bubbles up and is handled by two or more HTML elements? So
user clicks on DIV, onClick of DIV is executed, event bubbles up and onClick
of document is executed.

>Of course, the reason they are only really stopped from script, is because
>bubble is on by default, and because it is implemented in a different way
>between NS and IE, which makes standard bubbling a night-mare in DHTML.

Your example would work in all browsers. If onMouseMove is only defined for
the entire document the different event orders don't really matter. But I
see your point.

Thanks,

ppk

_________________________________________________________________
MSN Photos is the easiest way to share and print your photos:
http://photos.msn.com/support/worldwide.aspx




More information about the thelist mailing list