Skip to content

Commit

Permalink
bug #26450 [CssSelector] Fix CSS identifiers parsing - they can start…
Browse files Browse the repository at this point in the history
… with dash (jakubkulhan)

This PR was merged into the 2.7 branch.

Discussion
----------

[CssSelector] Fix CSS identifiers parsing - they can start with dash

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| License       | MIT

Vendor prefixes use `-` (dash) at the start of CSS identifiers.

Commits
-------

16e86bc [CssSelector] Fix CSS identifiers parsing - they can start with dash
  • Loading branch information
stof committed Mar 8, 2018
2 parents 1616d36 + 16e86bc commit 76c1251
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
Expand Up @@ -44,7 +44,7 @@ public function __construct()
$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.')*';
Expand Down
Expand Up @@ -186,6 +186,7 @@ public function getPseudoElementsTestData()
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'),
);
}

Expand Down

0 comments on commit 76c1251

Please sign in to comment.