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

We had spent some time discussing this issue at the W3C Workshop for Performance. Even if a developer wanted to specify that a single image be the highest priority download, I don't believe most major browser vendors would respect that priority order over CSS and synchronous JavaScript. Seeing these are hints to the browser, we wanted to avoid having developers try to specify different classes of priority numbers for resources. For most web developers, it feels like the easiest thing is to specify resources that they know aren't necessary for above the fold visuals.

In your example, the best approach for developers is to mark all unnecessary resources for the above the fold visuals as 'delayload'. This way all the important images, CSS, and JavaScript will be downloaded in the order the browser feels is most optimal. For example, a user agent may download in the following order: root document, CSS in document order, JavaScript in document order, everything else in document order, delayloaded resources in document order.

Thanks,
Jatinder

From: Steve Souders [mailto:souders@google.com]
Sent: Wednesday, May 22, 2013 12:36 PM
To: Jake Archibald
Cc: Jatinder Mann; public-web-perf@w3.org
Subject: Re: <img src="..." defer>

SHORT: We need the foil of "defer" so that image download priority is INcreased.

LONG:
I love the idea of being able to defer images, but that leaves images with only these two states:
    - deferred
    - not deferred

So I have two choices: my images get loaded very late, or they get loaded late (because scripts, stylesheets, and fonts have a higher download priority in some major browsers).

What if I have an IMG that I want to load at a higher priority?!

Here's a great example. Airbnb has a huge IMG that fills the background of the entire page. It's the very first IMG in the document. It's obviously critical to the UX. But, because of Chrome priorities, it gets loaded too late. In these WPT results<http://www.webpagetest.org/video/compare.php?tests=130515_TD_QYX-r%3A1-c%3A0&thumbSize=200&ival=100&end=visual> this huge image (the first IMG in the document!) gets pushed out to request #12 and doesn't show up until 3.4 seconds into the page load.

Instead, it would be better if this IMG was downloaded with equal priority to scripts & stylesheets, or at least higher priority than any other image (including CSS images). But, even if "defer" gets adopted, we'll still have no way to promote this IMG to get it to appear earlier.

We need the foil to "defer" so that image download priority is INcreased.

-Steve


On Wed, May 22, 2013 at 8:25 AM, Jake Archibald <jakearchibald@chromium.org<mailto:jakearchibald@chromium.org>> wrote:
On Tue, May 21, 2013 at 9:09 PM, Jatinder Mann <jmann@microsoft.com<mailto:jmann@microsoft.com>> wrote:
Based on discussions with web developers, the attribute name 'delay' doesn't seem clear and can carry the wrong connotations that the attribute is slowing down the page load
...I recommend we instead use the attribute name 'delayload'. This name is very clear that the attribute will delay loading the lower priority resource.

I imagine developers will react the same to 'delayload' as they do to 'delay', although I'm just guessing.

'delayload' as in 'delay the load' sounds like the image may delay the loading of the page, when (in terms of the load event of the document) it does the opposite.

'lazy' or 'lazyload' sounds more like it's only impacting the image, perhaps because it's an existing term and used frequently in relation to image loading.

Also, as XHRs can just be deprioritized through script and they are the only non-element on the list, I recommend we just remove them.

+1

Received on Thursday, 23 May 2013 00:19:40 UTC