-
Notifications
You must be signed in to change notification settings - Fork 48.8k
Float: Stringify crossorigin="anonymous"
#28958
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
Conversation
Comparing: d779eba...d5bdae7 Critical size changesIncludes critical production bundles, as well as any change greater than 2%:
Significant size changesIncludes any change greater than 0.2%: Expand to show |
d172865
to
070ed36
Compare
070ed36
to
82d10cf
Compare
crossorigin="anonymous"
The spec doesn't show it clearly but the invalid value state is also anonymous so conceptually I've been thinking about crossorigin as just a tri-value. missing, "", and "use-credentials" to map to no cors, anon cors, and credentials The other reason to use empty string aggressively is that it's just shorter. Are you concerned that folks will look at the tag and think something is wrong? or that the spec might change in the future and make this optimization semantically breaking? (I doubt they could do the latter given the hesitance to break the web so I feel pretty confident we can leave this be) |
I did 😅 Mainly because I got confused by the spec (empty value and I wouldn't have filed this if I understood that the empty value is the same as |
Yeah makes sense |
Summary
<img crossOrigin="anonymous" />
now creates the corresponding<link rel="preload" />
tag preservingcrossOrigin
sinceanonymous
is a valid value forcrossOrigin
.It doesn't change production behavior since it results in the same state. Mainly to just reduce confusion but then
crossOrigin="some-non-existing-value"
would also result incrossorigin=""
so maybe that's fine?How did you test this change?
Added test for
<img crossOrigin="anonymous" />
. Other tests were also updated so I'm curious if ignoringanonymous
is intended forpreconnect
.I also added a test showing how
crossOrigin
doesn't factor into keying. Mostly to show the difference between how Float andnext/legacy/image
differs with regard to preloading.next/legacy/image
currently adds a<link rel="preload" />
matchingcrossOrigin
of the last<img />
with the same key whereas Float usescrossOrigin
from the first image.