The ASYNC test?

17 views
Skip to first unread message

EricLaw

unread,
Apr 15, 2010, 4:44:32 PM4/15/10
to Browserscope
curious: Why does the BrowserScope Network category include a test for
the HTML5 ASYNC attribute, but not the older DEFER attribute?

Steve Souders

unread,
Apr 15, 2010, 5:31:18 PM4/15/10
to browse...@googlegroups.com, Browserscope
It should! A little harder to test. Can you suggest a setup?

-Steve

On Apr 15, 2010, at 1:44 PM, EricLaw <bay...@gmail.com> wrote:

> curious: Why does the BrowserScope Network category include a test for
> the HTML5 ASYNC attribute, but not the older DEFER attribute?
>

> --
> You received this message because you are subscribed to the Google
> Groups "Browserscope" group.
> To post to this group, send email to browse...@googlegroups.com.
> To unsubscribe from this group, send email to browserscope...@googlegroups.com
> .
> For more options, visit this group at http://groups.google.com/group/browserscope?hl=en
> .
>

EricLaw

unread,
Apr 17, 2010, 3:46:28 PM4/17/10
to Browserscope
I assume this could be measured like most of the other tests...

Something like this: http://www.enhanceie.com/test/defer/

<body>
This page detects whether your browser respects the DEFER attribute on
scripts.<br/>
<script>
var bWaitedForInlineExecution = true;
var oDT = new Date();
</script>
<script src="/test/defer/SlowScript.aspx" defer="defer"></SCRIPT>
<script>
var oDelta = (new Date() - oDT);
if (oDelta < 100) {bWaitedForInlineExecution = false;}
document.write("The DEFER block cost " + oDelta + "ms.");
</script>
</body>
</html>

This test suggests that Firefox and IE support DEFER, and Opera,
Safari, and Chrome do not.
> > .- Hide quoted text -
>
> - Show quoted text -

Steve Souders

unread,
Apr 22, 2010, 3:14:43 AM4/22/10
to browse...@googlegroups.com, EricLaw
This looks good. The spec says that if "the defer  attribute is present, then the script is executed when the page has finished parsing". This test shows that the deferred script was delayed after a subsequent script, but should we try to test more than that? For example:
    - Should the deferred script be downloaded before or after the load event?
    - Should the deferred script be executed before or after the load event?
    - Should the deferred script start downloading before or after subsequent normal scripts? (Imagine you have a deferred script followed by six normal scripts, all on the same domain. If the deferred script starts downloading immediately it'll block one of the normal scripts. That seems wrong.)
    - Should DOM elements below the deferred script be guaranteed to exist before the deferred script is executed?

I can imagine a dozen or so questions if we start thinking about images and stylesheets. I don't think the spec is clear on any of these questions. But if we're going to write a test, I'd like it to add as much specificity as feasible. (Not going crazy or anything.)

-Steve
Reply all
Reply to author
Forward
0 new messages