8000 [CssSelector] [HashParser] Added parsing support for dotted hashes · symfony/symfony@f78611e · GitHub
[go: up one dir, main page]

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f78611e

Browse files
committed
[CssSelector] [HashParser] Added parsing support for dotted hashes
1 parent 7d4b42c commit f78611e

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/Symfony/Component/CssSelector/Parser/Shortcut/HashParser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function parse(string $source): array
4040
// 1 => string 'test' (length=4)
4141
// 2 => string 'input' (length=5)
4242
// 3 => string 'ab6bd_field' (length=11)
43-
if (preg_match('/^(?:([a-z]++)\|)?+([\w-]++|\*)?+#([\w-]++)$/i', trim($source), $matches)) {
43+
if (preg_match('/^(?:([a-z]++)\|)?+([\w-]++|\*)?+#([\w.-]++)$/i', trim($source), $matches)) {
4444
return [
4545
new SelectorNode(new HashNode(new ElementNode($matches[1] ?: null, $matches[2] ?: null), $matches[3])),
4646
];

src/Symfony/Component/CssSelector/Tests/Parser/Shortcut/HashParserTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,15 @@ public function getParseTestData()
3636
{
3737
return [
3838
['#testid', 'Hash[Element[*]#testid]'],
39+
['#test.id', 'Hash[Element[*]#test.id]'],
3940
['testel#testid', 'Hash[Element[testel]#testid]'],
41+
['testel#test.id', 'Hash[Element[testel]#test.id]'],
4042
['testns|#testid', 'Hash[Element[testns|*]#testid]'],
43+
['testns|#test.id', 'Hash[Element[testns|*]#test.id]'],
4144
['testns|*#testid', 'Hash[Element[testns|*]#testid]'],
45+
['testns|*#test.id', 'Hash[Element[testns|*]#test.id]'],
4246
['testns|testel#testid', 'Hash[Element[testns|testel]#testid]'],
47+
['testns|testel#test.id', 'Hash[Element[testns|testel]#test.id]'],
4348
];
4449
}
4550
}

0 commit comments

Comments
 (0)
0