<img> setting src = "" should maybe be sync
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 https://github.com/w3c/web-platform-tests/pull/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.
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.
It sounds like we should not necessarily blindly follow the current specification, though.
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).
I see, I will also handle this case in https://bugzilla.mozilla.org/show_bug.cgi?id=1076583. Thank you, @zcorpan and @jdm.
Per https://github.com/whatwg/html/issues/4884#issuecomment-527867774, it looks like browsers have different behavior not only in non-responsive case, but also responsive case. :(
I was told webkit has still async behavior here. @rniwa do you think webkit would be will to follow Gecko's and Blink's behavior here?
Note that this is more subtle than just src="" is sync, see https://phabricator.services.mozilla.com/D218603