[whatwg] HTMLElement.onload

In 6.5.6.2 of the spec I found, that the onload event handler is now 
available for every HTML element in HTML5, which I think is a great 
improvement. But there is something on the load event, that I think 
would be worth some words to clarify.

According to 6.11.2 the load event is fired when the whole document is 
loaded; I did not find anything about element-specific load events. So I 
assume that element1.onload is triggered by the same event as 
element2.onload - the following two bodies would be equivalent:

<body>
   <p onload="dosomething(this)">Text</p>
   <p onload="dosomethingelse(this)">Text</p>
</body>

<body onload="dosomething(document.getElementById('foo'));
   dosomethingelse(document.getElementById('bar'))">
   <p id="foo">Text</p>
   <p id="bar">Text</p>
</body>

Is this assumption correct?

Generally, the list of events that must be supported by all HTML 
elements looks somehow confusing to me, as there are some events that 
only apply to special types of elements, such as media players or forms 
resp. form elements. How are e.g. onpause or oninput supposed to work if 
applied to span or p elements?

Received on Friday, 23 October 2009 07:16:13 UTC