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

[react] Add crossOrigin to SVGAttributes #40880

merged 1 commit into from
Dec 9, 2019

Conversation

icosahebron
Copy link
Contributor

Please fill in this template.

  • Use a meaningful title for the pull request. Include the name of the package modified.
  • Test the change in your own code. (Compile and run.)
  • Add or edit tests to reflect the change. (Run with npm test.)
  • Follow the advice from the readme.
  • Avoid common mistakes.
  • Run npm run lint package-name (or tsc if no tslint.json is present).

If changing an existing definition:

  • Provide a URL to documentation or source code which provides context for the suggested changes:

React supports SVG <image> elements with a crossOrigin prop. It even special-cases that prop so that it's rendered as an all-lowercase attribute in HTML (see facebook/react#14832).

This PR updates @types/react to reflect this, letting us write:

<image crossOrigin="anonymous"/>

instead of workarounds like:

<image {...{ crossOrigin: "anonymous" }}/>

@typescript-bot typescript-bot added this to Waiting for Reviewers in Pull Request Status Board Dec 6, 2019
@typescript-bot typescript-bot added the Popular package This PR affects a popular package (as counted by NPM download counts). label Dec 6, 2019
@typescript-bot
Copy link
Contributor

typescript-bot commented Dec 6, 2019

@icosahebron Thank you for submitting this PR!

🔔 @johnnyreilly @bbenezech @pzavolinsky @digiguru @ericanderson @DovydasNavickas @theruther4d @guilhermehubner @ferdaber @jrakotoharisoa @pascaloliv @Hotell @franklixuefei @Jessidhia @saranshkataria @lukyth @eps1lon @zieka - please review this PR in the next few days. Be sure to explicitly select Approve or Request Changes in the GitHub UI so I know what's going on.

If no reviewer appears after a week, a DefinitelyTyped maintainer will review the PR instead.

@typescript-bot
Copy link
Contributor

👋 Hi there! I’ve run some quick measurements against master and your PR. These metrics should help the humans reviewing this PR gauge whether it might negatively affect compile times or editor responsiveness for users who install these typings.

Let’s review the numbers, shall we?

Comparison details 📊
master #40880 diff
Batch compilation
Memory usage (MiB) 126.9 123.8 -2.5%
Type count 38899 38911 0%
Assignability cache size 46651 46670 0%
Language service
Samples taken 2121 2121 0%
Identifiers in tests 2638 2642 0%
getCompletionsAtPosition
    Mean duration (ms) 400.1 400.9 +0.2%
    Mean CV 7.7% 7.5%
    Worst duration (ms) 2701.4 2651.0 -1.9%
    Worst identifier memoized4Ref x
getQuickInfoAtPosition
    Mean duration (ms) 396.5 397.1 +0.1%
    Mean CV 7.8% 7.7% -0.5%
    Worst duration (ms) 2460.4 2258.3 -8.2%
    Worst identifier ref ref

It looks like nothing changed too much. I won’t post performance data again unless it gets worse.

@typescript-bot typescript-bot added the Perf: Same typescript-bot determined that this PR will not significantly impact compilation performance. label Dec 6, 2019
@@ -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.

@typescript-bot typescript-bot moved this from Waiting for Reviewers to Check and Merge in Pull Request Status Board Dec 9, 2019
@typescript-bot typescript-bot added Owner Approved A listed owner of this package signed off on the pull request. Merge:Express and removed Awaiting reviewer feedback labels Dec 9, 2019
@typescript-bot
Copy link
Contributor

A definition owner has approved this PR ⭐️. A maintainer will merge this PR shortly. If it shouldn't be merged yet, please leave a comment saying so and we'll wait. Thank you for your contribution to DefinitelyTyped!

@orta
Copy link
Collaborator

orta commented Dec 9, 2019

👍

@orta orta merged commit e2f32d2 into DefinitelyTyped:master Dec 9, 2019
Pull Request Status Board automation moved this from Check and Merge to Done Dec 9, 2019
@typescript-bot
Copy link
Contributor

I just published @types/react@16.9.16 to npm.

@icosahebron icosahebron deleted the react-svg-image-crossorigin branch December 9, 2019 17:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Owner Approved A listed owner of this package signed off on the pull request. Perf: Same typescript-bot determined that this PR will not significantly impact compilation performance. Popular package This PR affects a popular package (as counted by NPM download counts).
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants