dhtmlkitchen at gmail.com
Sat Mar 14 14:46:37 PDT 2009
On Sat, Mar 14, 2009 at 1:48 PM, Greg Houston <gregory.houston at gmail.com> wrote:
> 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
> is downloaded. Without the link element having an onload event there
> is not really a straightforward way of doing this.
It sounds like you want to load resource with dependencies.
> 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.
When a stylesheet is added to the document, how (or even if) the
resource is downloaded and applied is not part of any official
> There are other odd workarounds but none of them as straightforward,
> elegant, and easy to use as the link elements simply having an onload
I proposed a solution to a similar problem not too long ago.
<script depends="[idref]" ...></script>
This would allow for scripts to run without having to wait for
stylesheets to load. When the browser parses <script depends="...", it
looks for elements matching ids in the depends attribute and downloads
all of them before running the script.
This could be used for other resources, too.
- where [idref] is the stylesheet to be loaded.
> Thank you for your consideration.
You seem optimistic.
Check the thread: "[whatwg] defer on style, depends"
The first sentence:-
| This is a request for the link element to be given an onload attribute.
<link onload="loadPlayer()" ...>
- would solve your problem, but with less simplicity than the
> Greg Houston
More information about the whatwg