selectivizr icon indicating copy to clipboard operation
selectivizr copied to clipboard

:before and :after cannot be used with :nth-child, :nth-of-type, etc

Open ianthedev opened this issue 11 years ago • 2 comments

:before and :after cannot be used with CSS3 selectors such as :nth-child, :nth-of-type, first-of-type, :last-child, ...... etc.

For example, these aren't working:

div:nth-child(2):before {   }
div:last-child:after {   }
div:nth-of-type(3):after {   }

ianthedev avatar Apr 01 '13 18:04 ianthedev

Isn't a solution, but if you use two tags, do works.

.field-item:last-child span:after

eloivaque avatar Jun 04 '13 14:06 eloivaque

Thanks.

Actually it can be fixed by changing line 263 (or line 270 of v1.0.3b):

var domSelectorText = selectorText.replace(RE_LIBRARY_INCOMPATIBLE_PSEUDOS, EMPTY_STRING);

To

var domSelectorText = selectorText.replace(RE_LIBRARY_INCOMPATIBLE_PSEUDOS, EMPTY_STRING).replace(/:before|:after/, '');

ianthedev avatar Jun 05 '13 02:06 ianthedev