Skip to content
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

<img> setting src = "" should maybe be sync #2429

Open
zcorpan opened this issue Mar 13, 2017 · 6 comments
Open

<img> setting src = "" should maybe be sync #2429

zcorpan opened this issue Mar 13, 2017 · 6 comments

Comments

@zcorpan
Copy link
Member

zcorpan commented Mar 13, 2017

https://html.spec.whatwg.org/#updating-the-image-data

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.

From web-platform-tests/wpt#5060

See http://software.hixie.ch/utilities/js/live-dom-viewer/saved/4936

It seems that in Chromium and Gecko this case is sync (doesn't await a stable state).

With picture: http://software.hixie.ch/utilities/js/live-dom-viewer/saved/4937

Chromium: still sync. Gecko awaits a stable state. Per spec updates shouldn't be sync if srcset or picture are used.

WebKit seems a bit weird for the case of setting src to empty string or removing the src attribute doesn't change .width or the rendered dimensions but it doesn't render the old image.

@zcorpan
Copy link
Member Author

zcorpan commented Mar 13, 2017

Result in Edge 13 for 4936:

log: 0

@EdgarChen
Copy link
Member

EdgarChen commented Mar 14, 2017

See http://software.hixie.ch/utilities/js/live-dom-viewer/saved/4936
It seems that in Chromium and Gecko this case is sync (doesn't await a stable state).

Gecko now always sync loads image for non-responsive case (without picture and srcset), but we intent to change behaviour to follow the current spec, so http://software.hixie.ch/utilities/js/live-dom-viewer/saved/4936 will become async (await a stable state) after https://bugzilla.mozilla.org/show_bug.cgi?id=1076583.

@jdm
Copy link
Member

jdm commented Mar 14, 2017

It sounds like we should not necessarily blindly follow the current specification, though.

@zcorpan
Copy link
Member Author

zcorpan commented Mar 14, 2017

Yeah this a case I probably did not carefully consider before. Though given WebKit's behavior it may not be critical for Web compat either way. But it seems slightly safer to align with majority behavior (in the non-responsive case).

@EdgarChen
Copy link
Member

I see, I will also handle this case in https://bugzilla.mozilla.org/show_bug.cgi?id=1076583. Thank you, @zcorpan and @jdm.

@EdgarChen
Copy link
Member

Per #4884 (comment), it looks like browsers have different behavior not only in non-responsive case, but also responsive case. :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants