[CssSelector] Fix CSS identifiers parsing - they can start with dash
This commit is contained in:
parent
1616d368d9
commit
16e86bc0c0
@ -44,7 +44,7 @@ class TokenizerPatterns
|
||||
$this->nonAsciiPattern = '[^\x00-\x7F]';
|
||||
$this->nmCharPattern = '[_a-z0-9-]|'.$this->escapePattern.'|'.$this->nonAsciiPattern;
|
||||
$this->nmStartPattern = '[_a-z]|'.$this->escapePattern.'|'.$this->nonAsciiPattern;
|
||||
$this->identifierPattern = '(?:'.$this->nmStartPattern.')(?:'.$this->nmCharPattern.')*';
|
||||
$this->identifierPattern = '-?(?:'.$this->nmStartPattern.')(?:'.$this->nmCharPattern.')*';
|
||||
$this->hashPattern = '#((?:'.$this->nmCharPattern.')+)';
|
||||
$this->numberPattern = '[+-]?(?:[0-9]*\.[0-9]+|[0-9]+)';
|
||||
$this->quotedStringPattern = '([^\n\r\f%s]|'.$this->stringEscapePattern.')*';
|
||||
|
@ -186,6 +186,7 @@ class ParserTest extends TestCase
|
||||
array('foo:after', 'Element[foo]', 'after'),
|
||||
array('foo::selection', 'Element[foo]', 'selection'),
|
||||
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'),
|
||||
array('video::-webkit-media-controls', 'Element[video]', '-webkit-media-controls'),
|
||||
);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user