W3C home > Mailing lists > Public > public-web-perf@w3.org > April 2013

RE: <img src="..." defer>

From: Jatinder Mann <jmann@microsoft.com>
Date: Wed, 17 Apr 2013 19:09:27 +0000
To: "'public-web-perf@w3.org'" <public-web-perf@w3.org>, Jake Archibald <jakearchibald@google.com>, "James Simonsen (simonjam@google.com)" <simonjam@google.com>
Message-ID: <ee8305ba65474d1e90b894acb0d0b888@BLUPR03MB065.namprd03.prod.outlook.com>
Based on the discussion on the mailing list, performance workshop, and today's conference call, I have put together a draft of the Resource Priorities spec as a framework for discussion: https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/ResourcePriorities/Overview.html. Seeing that the normative text is only a few paragraphs, we may want to eventually put this information in the HTML5 spec. As the Web Perf WG has been chartered to solve this performance problem, I want to make sure this working group agrees that the feature text solves the performance problem before we add this to the HTML5 spec.

I believe most of the normative requirements should be "MAY" clauses instead of "MUST". The developer is giving the user agent hints on the download priorities of a resource based on their knowledge of what's important for the page's visuals. The user agent may choose to ignore those hints if it can opportunistically download those resources anyway.

I like the idea that elements that have been marked with the "defer" attribute shouldn't impact the load event, as there is a performance benefit of allowing scripts triggered on the load event to execute sooner. I would like to understand, though, if there are any concerns with us changing this fundamental behavior of the load event.

The defer attribute has already been used for script elements to mean that the script shouldn't be executed until the document has been parsed. As the developer's intention was to delay script execution, we may decide to build on that and also delay downloading the script until higher priority downloads have completed by redefining the "defer" attribute. However, if we decide to change the load event behavior for lower priorities resources, we may want to not redefine the "defer" attribute, as there may be a compatibility impact on sites that use "defer" today. In that case, we can consider renaming the attribute to "delay" or something else.

I don't agree that the user agent should look at style information or viewport placement to determine the download priority of a resource. Determining which resources are important for the page visuals is easiest for the developer, and the developer can decide on download priority of a resource by specifying or not specifying the attribute. As these are just hints, the user agent can choose to ignore them if it's beneficial to do so.

Received on Wednesday, 17 April 2013 19:11:54 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:04:35 UTC