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

[whatwg] Proposal for separating script downloads and execution

From: Kyle Simpson <getify@gmail.com>
Date: Tue, 1 Feb 2011 13:06:12 -0600
Message-ID: <F09BD193C07A441EB131147280AB5158@spartacus>
?> 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


 
Received on Tuesday, 1 February 2011 11:06:12 UTC

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