-
Notifications
You must be signed in to change notification settings - Fork 50.5k
Initialize React prop name/attribute name mapping without Map #12353
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
nhunzaker
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
| ['httpEquiv', 'http-equiv'], | ||
| ]).forEach((attributeName, name) => { | ||
| ['acceptCharset', 'className', 'htmlFor', 'httpEquiv'].forEach((name, i) => { | ||
| const attributeName = ['accept-charset', 'class', 'for', 'http-equiv'][i]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
might be clearer if it was an array of array pairs? Like maybe just the argument to the original map. Less likely to accidentally shift one array but not the other
jquense
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one small thought
Using `new Map(iterable)` isn't supported in IE11, so it ends up trying to iterate through an empty map and these attributes don't get defined in properties. Since this is only run once on startup inlining the attributeName array is probably fine.
c722931 to
108ad51
Compare
blling
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
…ok#12353) Using `new Map(iterable)` isn't supported in IE11, so it ends up trying to iterate through an empty map and these attributes don't get defined in properties. Since this is only run once on startup inlining the attributeName array is probably fine.
…ok#12353) Using `new Map(iterable)` isn't supported in IE11, so it ends up trying to iterate through an empty map and these attributes don't get defined in properties. Since this is only run once on startup inlining the attributeName array is probably fine.
Fixes #12349. See #12349 (comment).
Using
new Map(iterable)isn't supported in IE11, so it ends up trying to iterate through an empty map and these attributes don't get defined in properties. Since this is only run once on startup inlining theattributeNamearray is probably fine.