W3C home > Mailing lists > Public > whatwg@whatwg.org > August 2006

[whatwg] Events for added nodes while page is loading

From: Alexey Feldgendler <alexey@feldgendler.ru>
Date: Tue, 01 Aug 2006 16:13:27 +0700
Message-ID: <op.tdlk8p1j1h6og4@feldgendler.plesk.ru>
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
Received on Tuesday, 1 August 2006 02:13:27 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:58:48 UTC