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

feat: implement ::-v-deep as a shadow piercing combinator #54

Merged
merged 4 commits into from
Feb 21, 2019

Conversation

haoqunjiang
Copy link
Member

@haoqunjiang haoqunjiang commented Feb 3, 2019

In the long run we should move to shadow parts for such use cases. See this article (the syntax has slightly change since the article published but the idea remains).

A caveats of this implementation: since ::-v-deep is parsed as a pseudo element, we can't elegantly remove the arounding spaces, so there's an extra space remained in the added test case.

Update: as @Justineo pointed out, it is a common practice for a vendor prefixed selector to start with -, so renamed it to ::-v-deep.

@haoqunjiang haoqunjiang changed the title feat: implement ::v-deep as a shadow piercing combinator feat: implement ::-v-deep as a shadow piercing combinator Feb 3, 2019
@@ -35,6 +36,13 @@ export default postcss.plugin('add-id', (options: any) => (root: Root) => {
n.spaces.before = n.spaces.after = ''
return false
}

// in newer versions of sass, /deep/ support is also dropped, so add a ::-v-deep alias
if (n.type === 'pseudo' && n.value === '::-v-deep') {
Copy link
Member

Choose a reason for hiding this comment

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

why is it named ::-v-deep instead of ::v-deep?

Copy link
Member Author

Choose a reason for hiding this comment

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

CSS prefixes typically start with -, e.g. -webkit-, so I think we can follow this convention to indicate that it's not a standard selector.

Copy link
Member

Choose a reason for hiding this comment

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

I think it makes it more verbose than necessary. It's not a property name, and is also prefixed with :: already.

@yyx990803 yyx990803 merged commit 8b2c646 into vuejs:master Feb 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants