Warn when background-image with empty url sends an unnecessary request to the current page
Reported by
z...@rhizom.fr,
Feb 10 2017
|
||||||||
Issue descriptionUserAgent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36 Steps to reproduce the problem: 1. Open the linked html file 2. Open chrome dev tools and inspect network 3. A second request to the current html page is made with an image accept type (visible in attached screenshot). What is the expected behavior? Similarly to the issue caused by an <img src="" /> (for more info: https://www.nczonline.net/blog/2009/11/30/empty-image-src-can-destroy-your-site/). Apparently an empty src in a img tag does not throw a request anymore, I guess it should be the same in that case. According to my test, Edge seems to transform background-image: url() to background-image: none. At least, a specific warning could be added to highlight the fact that an empty url has been encountered which may lead to unnecessary request. What went wrong? As explained on the "how to reproduce" part, see the attached screenshot. Did this work before? No Does this work in other browsers? No - Can reproduce on Firefox 52.0b4 - No issue on edge (Microsoft Edge 38.14393.0.0/ Microsoft EdgeHTML 14.14393 Chrome version: 55.0.2883.87 Channel: stable OS Version: 10.0 Flash Version: Shockwave Flash 24.0 r0
,
Feb 10 2017
,
Feb 13 2017
Passing on to the loading team for more info on whether this is expected behaviour.
,
Feb 14 2017
Regarding image elements, it's specified at [1]. If the element does not use srcset or picture, and it has a src attribute specified and its value is not the empty string, let selected source be the value of the element's src attribute, and selected pixel density be 1.0. Otherwise, let selected source be null and selected pixel density be undefined. So the empty string should be ignored. I'm not so sure about css: According to [2] (which seems old though), the string should be parsed as URL relative to the base URL, it doesn't mention about an empty string. It seems empty string should be parsed into the base URL. Adding Blink>CSS expecting CSS people know more. 1: https://html.spec.whatwg.org/multipage/embedded-content.html#updating-the-image-data 2: https://www.w3.org/TR/CSS21/syndata.html#uri
,
Feb 14 2017
,
Feb 15 2017
Able to observe the same behavior on the latest canary(58.0.3012.0) of Mac OS 10.12.2 and Linux Ubuntu 14.04. Tested this on older chrome version: 30.0.1549.0 on Windows 10 and observed the similar behavior there as well. Attached is the screenshot of the same and removing the Needs-Bisect label.
,
Feb 16 2017
,
Feb 21 2017
Not seeing any spec justification for this behaviour. I advise pursuing this at the spec level. In the meantime it sounds reasonable that DevTools could warn the developer when this happens. Passing over to them.
,
Dec 11 2017
WontFix due to lack of priority / resources |
||||||||
►
Sign in to add a comment |
||||||||
Comment 1 by z...@rhizom.fr
, Feb 10 2017280 bytes
280 bytes View Download
98.8 KB
98.8 KB View Download