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

[whatwg] Link.onload; defer on style, depends

From: Sean Hogan <shogun70@westnet.com.au>
Date: Thu, 30 Apr 2009 11:10:20 +1000
Message-ID: <49F8FA7C.8090106@westnet.com.au>
Ian Hickson wrote:
> On Thu, 30 Apr 2009, Sean Hogan wrote:
>   
>>>>>>           
>>>>>> At least in Gecko, you can already detect whether the sheet is done
>>>>>> loading: if you try to get its cssRules and that throws
>>>>>> INVALID_ACCESS_ERR, then it's still loading.  (If it throws
>>>>>> DOM_SECURITY_ERR then you're not allowed to read the style data;
>>>>>> that's why you have to check for the exact type of exception thrown.
>>>>>> Though really, if you're loading style sheets cross-site you're in for
>>>>>> a world of hurt unless you control both sites.)
>>>>>>             
>>>>>         
>>>>> I haven't added readyState at this time. I am concerned about feature
>>>>> creep here.
>>>>>           
>>>>       
>>>> As for link.onload, link.readyState is implemented in IE since IE6. Same
>>>> values as document.readyState, etc.
>>>>         
>>> Sure, but we only need one way to do this.
>>>       
>> How do I check if the resource is already loaded? In a cross-browser, 
>> cross-site manner?
>>     
>
> Put an onload handler on the element before it loads and make it set a 
> flag you can check later.
>
>   
And what if the link-element is in the HTML text? The only way to 
guarantee that is to write it as <link onload="..." />
Surely if it is worth adding the onload event it is worth adding 
readyState or complete property.
Received on Wednesday, 29 April 2009 18:10:20 UTC

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