Skip to content

Commit 346be01

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

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
@@ -43,7 +43,7 @@ public function __construct()
4343
$this->stringEscapePattern = $this->newLineEscapePattern.'|'.$this->escapePattern;
4444
$this->nonAsciiPattern = '[^\x00-\x7F]';
4545
$this->nmCharPattern = '[_a-z0-9-]|'.$this->escapePattern.'|'.$this->nonAsciiPattern;
46-
$this->nmStartPattern = '[_a-z]|'.$this->escapePattern.'|'.$this->nonAsciiPattern;
46+
$this->nmStartPattern = '[_a-z-]|'.$this->escapePattern.'|'.$this->nonAsciiPattern;
4747
$this->identifierPattern = '(?:'.$this->nmStartPattern.')(?:'.$this->nmCharPattern.')*';
4848
$this->hashPattern = '#((?:'.$this->nmCharPattern.')+)';
4949
$this->numberPattern = '[+-]?(?:[0-9]*\.[0-9]+|[0-9]+)';

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)