-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
refactor (parseCssColor): use parseInt, avoid unnecessary coercion #20856
Conversation
Thanks for the PR @ljharb; any chance you could update |
Sure, i'll have to clone the repo so give me a few days. |
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.
LGTM
@@ -2742,34 +2742,34 @@ const HSL_PATTERN = new SafeRegExp( | |||
); | |||
|
|||
function parseCssColor(colorString) { | |||
if (MapPrototypeHas(colorKeywords, colorString)) { | |||
colorString = MapPrototypeGet(colorKeywords, colorString); | |||
if (colorKeywords.has(colorString)) { |
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.
FYI to other reviewers: safe because SafeMap
, but may result in prefer-primordials
linter errors. Let's see :)
EDIT: linter is happy :)
@bartlomieju |
@bartlomieju actually these are just refactors and have nothing to do with the meat of the node PR; what tests would you want me to include? |
@ljharb, oh I thought these tests were checking this change:
I'll take a look at the CI failure. |
Upstream some changes from nodejs/node#49205 Signed-off-by: Jordan Harband <ljharb@gmail.com>
any update? These are just simple refactors to improve the code quality and potentially performance. |
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.
Sorry for a slow response @ljharb. I revert that test file change as running update scripts for Node compat tests causes them to be removed anyway. Thanks, LGTM
Thanks! |
Upstream some changes from nodejs/node#49205