[whatwg] Proposal for separating script downloads and execution

Kyle Simpson getify at gmail.com
Tue Feb 1 11:06:12 PST 2011


?> The major issue I have with the way the spec is written is that there is 
no way to feature detect this capability. I'd like this behavior (which I 
agree, is useful), to be more explicit so we can easily make use where 
available.

I agree, the spec doesn't make it clear in its current wording how this 
could be feature-tested. And (as you know, Nicholas), I'm a firm believer 
that any new functionality *must* be feature-testable rather than 
browser-inferences or UA sniffing. :)

However, the current IE implementation (with the additional `readyState` 
property) does actually provide a feasible feature-test (in fact, I'm 
working on a new revision of LABjs to take advantage of this functionality 
for IE).

The feature-test for IE essentially looks for the presence of the 
`readyState` property on a newly created script element, and then also 
inspects its value, because in IE it always defaults to "uninitialized" as 
its value. The reason for having to also test the value is because Opera has 
had a present-but-non-functional `readyState` property on their script 
elements since like 9.2, with a default value of "loaded".

If the spec considers adding an event system to this mechanism similar to or 
compatible with IE's existing mechanism, I think this could be a valid 
approach to feature-testing, assuming the browsers all agree to play nicely. 
:)

--Kyle


 



More information about the whatwg mailing list