-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[CssSelector] Fix CSS identifiers parsing - they can start with dash #26450
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -43,7 +43,7 @@ public function __construct() | |||
$this->stringEscapePattern = $this->newLineEscapePattern.'|'.$this->escapePattern; | |||
$this->nonAsciiPattern = '[^\x00-\x7F]'; | |||
$this->nmCharPattern = '[_a-z0-9-]|'.$this->escapePattern.'|'.$this->nonAsciiPattern; | |||
$this->nmStartPattern = '[_a-z]|'.$this->escapePattern.'|'.$this->nonAsciiPattern; | |||
$this->nmStartPattern = '[_a-z-]|'.$this->escapePattern.'|'.$this->nonAsciiPattern; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checking the official CSS grammar I found this:
nmstart [_a-z]|{nonascii}|{escape}
nmchar [_a-z0-9-]|{nonascii}|{escape}
ident -?{nmstart}{nmchar}*
So maybe we should move the optional starting -
to $this->identifierPattern
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, fixed according to CSS grammar.
346be01
to
16e86bc
Compare
Good catch, thanks @jakubkulhan. |
… 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
Vendor prefixes use
-
(dash) at the start of CSS identifiers.