cssselect icon indicating copy to clipboard operation
cssselect copied to clipboard

Colon in attribute

Open Gallaecio opened this issue 3 years ago • 0 comments

In CSS, it turns out you can specify a colon in an attribute name by escaping it.

This is not valid:

::attr(:foo)

But this is:

::attr(\:foo)

And cssselect fails on the former and supports the later, as it should, only that it fails to translate it into a valid XPath expression. It turns it into:

descendant-or-self::*/@:foo

I’m not sure what the best XPath translation would be (this?), but the current one seem to be invalid XPath.

Gallaecio avatar Jun 23 '21 16:06 Gallaecio