[whatwg] Events for added nodes while page is loading

Robert Græsdal mail at robbiegee.com
Tue Aug 1 01:56:08 PDT 2006


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.

I figure we'd need events that fired when the node had been added and  
closed (meaning that all child nodes have been added and we are about to  
start on the sibling). For instance, if you had the code:

<html>
<head><title>Test</title></head>
<body>
<p>This is a paragraph</p>
</body>
</html>

You'd have the events fired as such (+ means an add event, / means a  
"close" event. Ignoring whitespace-only text nodes):
+html
+head
+title
+#Test
/title
/head
+body
+p
+#This is a paragraph
/p
/body
/html

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?

- Robert Græsdal



More information about the whatwg mailing list