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

Does removing or adding a `crossorigin` attribute to an `img` tag count as a "relevant mutation"? #4533

Open
spinda opened this Issue Apr 15, 2019 · 3 comments

Comments

3 participants
@spinda
Copy link

spinda commented Apr 15, 2019

"4.8.4.3.2 Reacting to DOM mutations" lays out a set of mutations to an <img> tag which should cause the image resource to be reloaded. This includes both

  • The element's src, srcset, width, or sizes attributes are set, changed, or removed.

and

  • The element's crossorigin attribute's state is changed.

Now, it would make sense to me for adding or removing a crossorigin attribute to force an image reload, as that changes the effective CORS mode between No CORS and another value. However, note the language difference between "set, changed, or removed" and "state is changed". Is this supposed to imply that adding/removing crossorigin isn't a "relevant mutation"? If so, why?

@domenic

This comment has been minimized.

Copy link
Member

domenic commented Apr 15, 2019

The state refers to https://html.spec.whatwg.org/multipage/urls-and-fetching.html#cors-settings-attributes . As you can see there are ways to change the attribute value without changing the state (e.g. changing the value from "use-credentials" to "USE-CREDENTIALS"). Removing or adding the attribute does change the state.

This seems pretty rigorous in the spec as-is, so I'm not sure there's a bug here, but let us know if there's anything unclear still.

@spinda

This comment has been minimized.

Copy link
Author

spinda commented Apr 15, 2019

Got it, thanks! Maybe inserting a cross-reference to that page would be helpful here. It seems Firefox gets this wrong, despite passing the relevant mutations test cases, which appear to be broken (all these 'timeout's should be 'load's, and the corresponding <img> tags are all missing src attributes).

@spinda

This comment has been minimized.

Copy link
Author

spinda commented Apr 15, 2019

(Not to pick on Firefox here: after fixing the test cases, it appears Chromium isn't taking the crossorigin attribute into account at all.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.