W3C home > Mailing lists > Public > whatwg@whatwg.org > March 2009

[whatwg] Link.onload

From: Greg Houston <gregory.houston@gmail.com>
Date: Sat, 14 Mar 2009 15:48:07 -0500
Message-ID: <29ae901a0903141348o54d305a3h5753f4542a1c5925@mail.gmail.com>
This is a request for the link element to be given an onload attribute.

Often when lazy loading a plugin into an web app it is necessary for
the plugin's stylesheets to be applied before the plugin's JavaScript
is downloaded. Without the link element having an onload event there
is not really a straightforward way of doing this.

Currently I am using XMLHttpRequests to grab the stylesheets first
since XHR has a success callback, and then appending the stylesheets
to the document.head relying on the browser using the cached
stylesheet. This seems to work for the most part, but really there are
no guarantees.

There are other odd workarounds but none of them as straightforward,
elegant, and easy to use as the link elements simply having an onload
attribute.

Thank you for your consideration.

Greg Houston
Received on Saturday, 14 March 2009 13:48:07 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 30 January 2013 18:47:49 GMT