[whatwg] script postonload

On Wed, Feb 10, 2010 at 12:57 AM, Anne van Kesteren <annevk at opera.com> wrote:
> On Mon, 08 Feb 2010 23:06:07 +0100, Steve Souders <steve at souders.org> wrote:
>>
>> I'd like to propose the addition of a POSTONLOAD attribute to the SCRIPT
>> tag.
>>
>> The behavior would be similar to DEFER, but instead of delaying downloads
>> until after parsing they would be delayed until after the window's load
>> event. Similar to DEFER, this new attribute would ensure scripts were
>> executed in the order they appear in the document, although it could be
>> combined with ASYNC to have them execute as soon as the response is
>> received.
>>
>> Developers can do this now using JavaScript, but it's complex and
>> errorprone. For example, how should the script be added to the document?
>> People typically append to the 'head' element, but some pages don't have a
>> 'head' element and some browsers don't create a default one. And
>> 'documentElement' doesn't work in all browsers either. The safest path I've
>> seen is to append to ( head || body ). Whether everyone agrees this is best,
>> it reveals the complexity developers will have to consider.
>>
>> Adding this attribute would lower the bar promoting this best practice for
>> making web pages faster.
>
> Which browsers do not create a <head> element? I thought we fixed our bug.
> Also, introducing new features mainly to work around existing bugs is
> generally not a good idea. We'd only increase the potential for
> interoperability issues.

Also note that introducing a new feature X in order to work around
shortcomings in implementations in another feature Y doesn't really
make sense. What is to say that you'll get interoperability in X any
earlier than in Y?

In other words, what is to say that browsers will implement postonload
before they'll implement .head or .documentElement?

/ Jonas

Received on Wednesday, 10 February 2010 11:40:20 UTC