Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[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

Merged
merged 1 commit into from
Mar 8, 2018

Conversation

jakubkulhan
Copy link
Contributor

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.

@@ -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;
Copy link
Member

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?

Copy link
Contributor Author

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.

@stof
Copy link
Member

stof commented Mar 8, 2018

Good catch, thanks @jakubkulhan.

@stof stof merged commit 16e86bc into symfony:2.7 Mar 8, 2018
stof added a commit that referenced this pull request Mar 8, 2018
… 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants