Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
crossOrigin attribute needs to be applied before <img src> attribute #14035
Do you want to request a feature or report a bug?
What is the current behavior?
React doesn't handle changing the crossOrigin attribute properly
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. Your bug will get fixed much faster if we can run your code and it doesn't have dependencies other than React. Paste the link to your JSFiddle (https://jsfiddle.net/Luktwrdm/) or CodeSandbox (https://codesandbox.io/s/new) example below:
Same img going from no
It looks like this is probably because the src attribute gets assigned first. If you change the JSX to have the crossorigin tag before the src then it looks like it works correctly.
We have a special case for
We could possibly do similar for crossorigin, though I'm unsure if we should want to.
changed the title
Bug when rendering a new img with same src but different crossOrigin attribute
Oct 30, 2018
Can this be relied on? As far as I can tell neither Babel docs nor the JSX spec specify that the input order is preserved in the output (although empirically it does appear to be with Babel), and MDN states that object iteration order is implementation-dependent (although empirically it does appear to match the declaration order, at least with object literals with string keys).