-
-
Notifications
You must be signed in to change notification settings - Fork 76
fix selector ordering with pseudo elements #383
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
fix selector ordering with pseudo elements #383
Conversation
assert.deepEqual(calculate(':before'), { a: 0, b: 0, c: 1 }); | ||
assert.deepEqual(calculate('::before'), { a: 0, b: 0, c: 1 }); | ||
|
||
assert.deepEqual(calculate(':focus'), { a: 0, b: 1, c: 0 }); |
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.
This package lacked sufficient coverage for pseudo elements vs classes.
@@ -67,9 +67,6 @@ function selectorTypeOrder(selector, type) { | |||
return selectorTypeOrderIndex.pseudoElement; | |||
} | |||
|
|||
if (type === 'pseudo' && selector && selector.indexOf('::') === 0) { |
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.
selectorParser.isPseudoElement(selector)
on line 66 expects a Node
and this didn't work before because it was a string.
This code on line 70 was insufficient but did work with strings.
Same change in all other plugins with similar logic.
@@ -22,7 +22,7 @@ const creator: PluginCreator<pluginOptions> = (opts?: pluginOptions) => { | |||
|
|||
return { | |||
postcssPlugin: 'postcss-cascade-layers', | |||
Once(root: Container, { result }: { result: Result }) { | |||
OnceExit(root: Container, { result }: { result: Result }) { |
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.
see : #374
This change will likely be merged and released before we can add it to preset-env
so adding it here as it is an obvious improvement.
Awesome work! Getting this out ! |
fixes : #382