Closed kof closed 7 years ago
@kof can you clarify please? When I'm changing sheet.classes
they're being changed in markup. The idea is to leave actual classnames intact while changing only selector.
they're being changed in markup
yes, is that an issue?
Yes, the point is to increase selector strength, so we're prefixing it with :not(#\\20)
, but className itself should stay the same. For instance:
html:
<div class="root-0"></div>
css:
:not(#\\20).root-0 {
/* ... */
}
right, it wouldn't work over class name anyways.
The only problem there is that .selector can be any valid css selector, so prefixing it is not that easy without a full parser. I suggest to prefix only scoped selectors with a single-class selector.
I think we need something like rule.scoped
// true
can you give an example where it can be an issue? All these examples look valid to me:
:not(#\\20)a {}
:not(#\\20).root-0 {}
:not(#\\20).root-0::placeholder {}
:not(#\\20)[type=button] {}
/* etc. */
selector can be something like this: :matches(:hover, :focus), .a
Got it. I guess it will be fixed in #4
I am refactoring sheet.classes registration logic for JSS 9. The idea is that we will have in sheet.classes only generated class names. Any possible selector from a jss-global or jss-nested won't land there any more. StyleRule#selector on the other side can contain any possible CSS selector, which makes it hard to correctly prefix without a full selector parser.
Thats why I suggest to use
sheet.classes
and split by space to supportclasses={button: 'a b'}
, see #4