docs: clarify scoped CSS selector performance#3426
Open
ishaanlabs-gg wants to merge 1 commit into
Open
Conversation
✅ Deploy Preview for vuejs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
bencodezen
requested changes
Jul 3, 2026
bencodezen
left a comment
Member
There was a problem hiding this comment.
I like the clarity around the browser impact to be less absolute, but I do think this rewrite hides the original message that using generic HTML selectors as scoped styles being slower performance wise.
In addition, the scoped styles is explained earlier in the section, so we should avoid re-explaining it in the tip.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of Problem
The scoped CSS tips currently say an element selector such as
p { color: red }will be "many times slower" when scoped. That warning is directionally useful, but it reads more absolute than current browser behavior warrants and does not tell readers when they should actually care.Addresses vuejs/core#2608.
Proposed Solution
This updates the tip to explain what scoped CSS compiles to, notes that selector cost depends on the browser, selector, and affected DOM size, and keeps the practical guidance to prefer classes or ids in large or frequently updated component trees.
Additional Information
Validation:
git diff --check HEAD~1 HEADThis is a docs-only wording change, so I did not run the full VitePress site build.