[whatwg] Scripting Tweaks

Dean Edwards dean at edwards.name
Wed Apr 20 06:51:26 PDT 2005


There are some scripting tweaks I'd like to see in WA1. Apologies if 
these have been covered already:

1) Mozilla's DOMContentLoaded event is very handy. It fires when a 
node's content has been loaded and parsed (the DOM has been 
constructed). This is much better than the standard onload event as it 
doesn't wait for binary content to also load.

2) I'd like to be able to lock/disable an entire document. This is 
useful when submitting to hidden frames. It helps prevent users from 
re-submitting data before it has been processed. Ideally, I could 
disable an entire frameset. Better yet, I can display some kind of 
visual feedback so that the user knows the page is locked (e.g. 
hourglass, greyed out content).

3) I find myself using Microsoft's uniqueID property quite often. 
Although the ID attribute is supposed to provide a unique identifier, it 
often doesn't. We would probably need a complementary DOM method to 
retrieve an element by uniqueID (IE uses the "all" property).

http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/uniqueid.asp

4) Most DOM scripting revolves around elements. Consequently, I write 
lots of loops like this:

for (var i = 0; i < childNodes.length; i++) {
   if (childNodes[i].nodeType == Node.NODE_ELEMENT) {
     // do something with the element
   }
}

It would be handy to have the following DOM properties:

childElements
firstChildElement
lastChildElement
previousElement
nextElement
parentElement

handy but definitely not required.

That's it for the time being. I'll post more as I think of them.

-dean




More information about the whatwg mailing list