Skip to content

Unescape CSS selector to XPath for id and class fields #18247

@tdewolff

Description

@tdewolff

This is a bug report for https://github.com/symfony/css-selector

Given a CSS selector #abc\.def that matches an element <div id="abc.def"> the resulting XPath selector contains [@id = '#abc\.def'], but the backslash should be omitted for the XPath. The XPath converter should unescape CSS selector parts, this holds for ID's, classes and element names.

EDIT: it does seem to unescape hex sequences (\34 5 => 45) but not other special characters such as . and :

Test code:

$xpath = (new CssSelectorConverter())->toXPath('#abc\.def');
// descendant-or-self::*[@id = 'abc\.def']

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions