Skip to content

CSS Selector fail to select element with colon char in ID #44516

@gabrielpl

Description

@gabrielpl

Symfony version(s) affected

5.4.0

Description

I´m using DomCrawler and CssSelector components to parse XML pages.
If the ID attribute of a tag has a colon char, the ID selector (#) fail to find the element.

How to reproduce

$xml = <<<XML
<?xml version="1.0" encoding="UTF-8"?>
<content>
  <tag id="test">foo</tag>
  <tag id="test:colon">bar</tag>
</content>
XML;

$crawler = new Crawler();
$crawler->addXmlContent($xml);

var_dump(
    $crawler->filter('#test')->count(),
    $crawler->filter('#test\:colon')->count() // notice the colon char is escaped
);

Possible Solution

No response

Additional Context

No response

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

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy