shadycss icon indicating copy to clipboard operation
shadycss copied to clipboard

:dir() is not transformed correctly with complicated selectors

Open dfreedm opened this issue 7 years ago • 2 comments

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 {}

dfreedm avatar Jan 17 '19 22:01 dfreedm

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.

sorvell avatar Jan 18 '19 00:01 sorvell

Yeah, that seems excessively complicated

dfreedm avatar Jan 18 '19 01:01 dfreedm