W3C home > Mailing lists > Public > whatwg@whatwg.org > February 2010

[whatwg] script postonload

From: Jonas Sicking <jonas@sicking.cc>
Date: Wed, 10 Feb 2010 11:45:18 -0800
Message-ID: <63df84f1002101145t48a4df02q44d612821a82ae77@mail.gmail.com>
On Wed, Feb 10, 2010 at 11:40 AM, Jonas Sicking <jonas at sicking.cc> wrote:
> 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?

Erm.. sorry, you already said that. Never mind me, nothing to see
here. Carry on!

/ Jonas
Received on Wednesday, 10 February 2010 11:45:18 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:21 UTC