8000 [CssSelector] Fix CSS identifiers parsing - they can start with dash · symfony/symfony@16e86bc · GitHub
[go: up one dir, main page]

Skip to content

Commit 16e86bc

Browse files
committed
[CssSelector] Fix CSS identifiers parsing - they can start with dash
1 parent 1616d36 commit 16e86bc

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/Symfony/Component/CssSelector/Parser/Tokenizer/TokenizerPatterns.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function __construct()
4444
$this->nonAsciiPattern = '[^\x00-\x7F]';
4545
$this->nmCharPattern = '[_a-z0-9-]|'.$this->escapePattern.'|'.$this->nonAsciiPattern;
4646
$this->nmStartPattern = '[_a-z]|'.$this->escapePattern.'|'.$this->nonAsciiPattern;
47-
$this->identifierPattern = '(?:'.$this->nmStartPattern.')(?:'.$this->nmCharPattern.')*';
47+
$this->identifierPattern = '-?(?:'.$this->nmStartPattern.')(?:'.$this->nmCharPattern.')*';
4848
$this->hashPattern = '#((?:'.$this->nmCharPattern.')+)';
4949
$this->numberPattern = '[+-]?(?:[0-9]*\.[0-9]+|[0-9]+)';
5050
$this->quotedStringPattern = '([^\n\r\f%s]|'.$this->stringEscapePattern.')*';

src/Symfony/Component/CssSelector/Tests/Parser/ParserTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ public function getPseudoElementsTestData()
186186
array('foo:after', 'Element[foo]', 'after'),
187187
array('foo::selection', 'Element[foo]', 'selection'),
188188
array('lorem#ipsum ~ a#b.c[href]:empty::selection', 'CombinedSelector[Hash[Element[lorem]#ipsum] ~ Pseudo[Attribute[Class[Hash[Element[a]#b].c][href]]:empty]]', 'selection'),
189+
array('video::-webkit-media-controls', 'Element[video]', '-webkit-media-controls'),
189190
);
190191
}
191192

0 commit comments

Comments
 (0)
0