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

Fixed selector|value-no-vendor-prefix performance #7016

Merged
merged 5 commits into from Jun 30, 2023
Merged

Fixed selector|value-no-vendor-prefix performance #7016

merged 5 commits into from Jun 30, 2023

Conversation

jeddy3
Copy link
Member

@jeddy3 jeddy3 commented Jun 30, 2023

Which issue, if any, is this issue related to?

#6869

Is there anything in the PR that needs further explanation?

selector-no-vendor-prefix

Mean: 246.52507291666666 ms
Deviation: 22.75678614753106 ms

To

Mean: 91.62227779999999 ms
Deviation: 7.8451629248369095 ms

value-no-vendor-prefix

Mean: 102.0994388 ms
Deviation: 11.78154094781758 ms

To

Mean: 91.27013606666667 ms
Deviation: 15.351019516794766 ms

@changeset-bot
Copy link

changeset-bot bot commented Jun 30, 2023

🦋 Changeset detected

Latest commit: 6a918a6

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
stylelint Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

.changeset/short-onions-play.md Outdated Show resolved Hide resolved
lib/rules/selector-no-vendor-prefix/index.js Outdated Show resolved Hide resolved
lib/utils/hasPrefix.js Outdated Show resolved Hide resolved
jeddy3 and others added 2 commits June 30, 2023 12:18
Co-authored-by: Masafumi Koba <473530+ybiquitous@users.noreply.github.com>
Co-authored-by: Masafumi Koba <473530+ybiquitous@users.noreply.github.com>
Copy link
Member

@ybiquitous ybiquitous left a comment

Choose a reason for hiding this comment

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

Great! LGTM 👍🏼

lib/utils/hasPrefix.js Outdated Show resolved Hide resolved
jeddy3 and others added 2 commits June 30, 2023 12:34
Co-authored-by: Masafumi Koba <473530+ybiquitous@users.noreply.github.com>
Copy link
Member

@ybiquitous ybiquitous left a comment

Choose a reason for hiding this comment

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

Thank you! 👍🏼

@jeddy3 jeddy3 merged commit 3065425 into main Jun 30, 2023
18 checks passed
@jeddy3 jeddy3 deleted the fix-nvp-p branch June 30, 2023 11:46
@@ -0,0 +1,5 @@
const prefixes = new Set(['-webkit-', '-moz-', '-ms-', '-o-']);
Copy link
Contributor

Choose a reason for hiding this comment

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

If this is to be reused, Ill eventually add some more rare ones to the set.

ref: https://stackoverflow.com/questions/11705144/webkit-and-its-legacy-prefixes

!isStandardSyntaxProperty(decl.prop) ||
!value.startsWith('-')
) {
if (!hasPrefix(value)) return;
Copy link
Contributor

Choose a reason for hiding this comment

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

A more agnostic way would be to use

prefix(prop) {
const match = prop.match(/^(-\w+-)/);
if (match) {
return match[0] || '';
}
return '';
},

instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants