-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Treatment of fallback image on <img src=''> #3280
Comments
Your understanding of "set" is correct. This is a bit more complex though, as it appears to depend on the width/height: https://jsbin.com/foyapuz/1/edit?html,output Note that per the normative text in https://html.spec.whatwg.org/#update-the-image-data, src="" always causes a broken image. (Instead of, e.g., fetching the contents of the base URL after resolving the empty string against the page's base URL.) Based on the above test case appear to be several behaviors in current browsers for broken images:
So I guess we should update the spec to point toward the first option here, revert the Chrome change, and file an Edge bug? What do you think? |
Note that the |
Blink reverted to its previous treatment of SRC='' under the chromium bug I quoted so it would certainly be great to get the spec updated to match the preferred behaviour for the SRC='' case. |
@mwenge would you be interested in writing such a change? |
When src is an empty string (<img src='') and the alt attribute is not set UAs currently agree that nothing should be displayed. Update the rules to specify this behaviour. Closes #3280.
Reopening so this feedback by @triple-underscore is considered:
|
That was dumb. :) |
Thanks @triple-underscore! |
When src is an empty string (<img src='') and the alt attribute is not set UAs currently agree that nothing should be displayed. Update the rules to specify this behaviour. Closes whatwg#3280.
Fix commit e78f98b which added the text to the wrong paragraph. Closes whatwg#3280, again.
To my reading
<img src=''>
falls into the part of https://html.spec.whatwg.org/multipage/embedded-content.html#the-img-element that says: "If the src attribute is set and the alt attribute is not.. the user agent should display some sort of indicator that there is an image that is not being rendered".In https://bugs.chromium.org/p/chromium/issues/detail?id=793206 we encountered interoperability issues because Blink now renders a fallback image in that case, rather then 'nothing' like other browsers.
As far as I can see Blink is following the spec here, unless src is not considered 'set' when src=''.
Have I misunderstood the meaning of 'set' in this case? And if not, should the spec be changed to allow rendering 'nothing' in this case as it is what all browsers do (apart from Blink since Chrome M63)? (Although FF is the only other browser that currently attempts to follow this part of the spec, and it seems to treat src='' as 'not set'.
The text was updated successfully, but these errors were encountered: