-
Notifications
You must be signed in to change notification settings - Fork 35
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
Should attribute removal be sync? #261
Comments
This broke a bunch of tests which made me think it might not be Web compat. Let's further discuss to see if it's a good idea or not. |
WebKit keeps showing the old image when removing the src attribute. When srcset is also present: Since the spec has a sync/async split on whether srcset/picture is present, I think it makes sense to do that here also. Given the implemented divergence, it is hopefully not a huge Web compat problem for WebKit/Blink to change to match IE/Gecko. |
Do we want to abort the pending request sync when src is removed? Looking at the Network tab in devtools, it seems like Gecko does. http://software.hixie.ch/utilities/js/live-dom-viewer/saved/3452 I think it might be bad to abort requests sync here, since the script might not be done with whatever it's going to do. For instance, consider a script that wants to "upgrade" an I think the way to do this in the spec is to add a step right before step 6 (await a stable state):
|
The first step is probably to try to align that code with Gecko/IE in both Blink and WebKit, and see what breaks and why. I'm looking into that. Will report back. |
FWIW the current Gecko behavior is to behave synchronously if: We have no https://dxr.mozilla.org/mozilla-central/source/dom/html/HTMLImageElement.cpp#896 |
See also Mozilla bug 1076583 |
@Nephyrin thanks. Can you give an example of there being a queued update the image data task? |
The spec already does that when setting src to a value that is in the "list of available images", and the same reasoning applies there. Possibly we could defer the request abortings until after step 6 in that case also. WDYT? |
I believe something like: <img src="foo" srcset="bar">
<script>
img.removeAttribute("srcset");
img.removeAttribute("src");
</script> Removing <img src="foo" srcset="bar">
<script>
img.removeAttribute("srcset");
setTimeout(function() {
img.removeAttribute("src");
}, 0);
</script> Would remove src synchronously, as the task had run and the tag now considered itself "non-responsive". Some of this logic was to prevent changing event ordering when |
Bumped into a Blink bug where attribute removal fails to update width/height synchronously (or at all :/).
Since there are no advantages of making the "update the image data" phase async for this, I suggest we make this phase sync in that case.
@zcorpan - WDYT?
The text was updated successfully, but these errors were encountered: