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

[react] Add crossOrigin to SVGAttributes #40880

Merged
merged 1 commit into from
Dec 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions types/react/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2259,6 +2259,7 @@ declare namespace React {
// Other HTML properties supported by SVG elements in browsers
role?: string;
tabIndex?: number;
crossOrigin?: "anonymous" | "use-credentials" | "";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the purpose of the blank string as an allowed value here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The blank string appears in the <img> equivalent:

crossOrigin?: "anonymous" | "use-credentials" | "";

and when used as an attribute value, is treated the same as anonymous

Setting the attribute name to an empty value, like crossorigin or crossorigin="", is the same as anonymous.


// SVG Specific attributes
accentHeight?: number | string;
Expand Down
1 change: 1 addition & 0 deletions types/react/test/elementAttributes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ const testCases = [
<span autoCorrect="on" />,
<span translate="no" />,
<span translate="yes" />,
<svg><image crossOrigin="anonymous"/></svg>,
];