[whatwg] Events for added nodes while page is loading

Alexey Feldgendler alexey at feldgendler.ru
Tue Aug 1 02:13:27 PDT 2006


On Tue, 01 Aug 2006 15:56:08 +0700, Robert Græsdal <mail at robbiegee.com> wrote:

> It'd be nice to have an event that'd tell my script when a new dom node
> have been added to the DOM tree /while it is loading/. Some documents just
> take quite a while to load, so it'd be nice to be able to modify nodes as
> they were added to the DOM tree.

Yes, this would help a lot when writing client-side scripts which modify pages as they are loaded, removing unwanted content such as Flash. Some browsers (Opera) have a mechanism like "User JS" to register a script which runs before every page starts loading. It can register event listeners, but currently there is no way for such script to e.g. prevent loading of Flash. It can only remove all Flash objects in document.onload handler, but by that time some Flash objects might have already started playing.

> If one relied on events not being retroactive (in that they only fire
> after the event has been registered, and you're not told about those
> already added), I am realizing one would probably never get to register
> the root node's creation, and for html, neither would the head's opening
> event. I don't think that'd be a problem, but... comments?

With mechanisms such as "User JS", a script can register so early as to get the event for creation of the root node.


-- 
Alexey Feldgendler <alexey at feldgendler.ru>
[ICQ: 115226275] http://feldgendler.livejournal.com



More information about the whatwg mailing list