Skip to content

Allow CSS level 3 selectors for classes and ids in the attributes extension - #1013

Merged
colinodell merged 3 commits into
thephpleague:2.4from
xavierlacot:fix/css-level-3-selectors
Jul 22, 2024
Merged

Allow CSS level 3 selectors for classes and ids in the attributes extension#1013
colinodell merged 3 commits into
thephpleague:2.4from
xavierlacot:fix/css-level-3-selectors

Conversation

@xavierlacot

Copy link
Copy Markdown
Contributor

The CSS level 3 Syntax, which is a Recommendation since 2018, allows much more characters in id and class selectors than the ones currently supported by the "Attributes" extension:

private const SINGLE_ATTRIBUTE = '\s*([.#][_a-z0-9-]+|' . RegexHelper::PARTIAL_ATTRIBUTENAME . RegexHelper::PARTIAL_ATTRIBUTEVALUESPEC . ')\s*';

The formal CSS level 3 selectors grammar is detailed here: https://www.w3.org/TR/selectors-3/#w3cselgrammar

This pull request adds a test to check several valid class and id names that are currently failing to be parsed as valid attribute values by the "Attributes" extension, and it proposes a fix for this issue.

@colinodell colinodell left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for contributing this improvement!

@colinodell
colinodell merged commit fd3c4e6 into thephpleague:2.4 Jul 22, 2024
@xavierlacot
xavierlacot deleted the fix/css-level-3-selectors branch July 31, 2024 12:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants