Skip to content

Commit b8fb8e8

Browse files
chrisvfritzyyx990803
authored andcommitted
Add warning about using scoped in place of classes (#206)
1 parent 1f23bb0 commit b8fb8e8

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

docs/features/scoped-css.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,6 @@ Into the following:
4646

4747
3. Partials are not affected by scoped styles.
4848

49-
4. **Be careful with descendant selectors in recursive components!** For a CSS rule with the selector `.a .b`, if the element that matches `.a` contains a recursive child component, then all `.b` in that child component will be matched by the rule.
49+
4. **Scoped styles do not eliminate the need for classes**. Due to the way browsers render various CSS selectors, `p { color: red }` will be many times slower when scoped (i.e. when combined with an attribute selector). If you use classes or ids instead, such as in `.example { color: red }`, then you virtually eliminate that performance hit. [Here's a playground](http://stevesouders.com/efws/css-selectors/csscreate.php) where you can test the differences yourself.
50+
51+
5. **Be careful with descendant selectors in recursive components!** For a CSS rule with the selector `.a .b`, if the element that matches `.a` contains a recursive child component, then all `.b` in that child component will be matched by the rule.

0 commit comments

Comments
 (0)