shadycss
shadycss copied to clipboard
:dir() is not transformed correctly with complicated selectors
The :dir() transform happens after selectors are split into "simple" selectors, without ancestor/descendant/sibling combinators.
However, the output of the :dir() transform creates two selectors, and both must contain the whole of the input selector.
Example for x-foo element:
:dir(rtl) > #foo > #bar {}
should be
[dir="rtl"] .x-foo > #foo.x-foo > #bar.x-foo, .x-foo[dir="rtl"] > #foo.x-foo > #bar.x-foo {}
but is transformed as
[dir="rtl"] .x-foo, .x-foo[dir="rtl"] > #foo.x-foo > #bar.x-foo, .x-foo[dir="rtl"] > #foo.x-foo > #bar.x-foo {}
Let's consider this case:
#zot > #hug:dir(rtl) > #foo > #bar {}
That should be
[dir="rtl"] #zot > #hug.x-foo > #foo.x-foo > #bar.x-foo,
#zot[dir="rtl"] > #hug.x-foo > #foo.x-foo > #bar.x-foo,
#zot.x-foo > #hug[dir="rtl"].x-foo > #foo.x-foo > #bar.x-foo {}
In other words, we need a new selector for each compound selector to the left of the :dir.
However, this is pretty complicated and it may not be worth supporting this.
Yeah, that seems excessively complicated