Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

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

Merged
merged 3 commits into from
Jul 22, 2024

Conversation

xavierlacot
Copy link
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.

Copy link
Member

@colinodell colinodell left a comment

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
14 of 15 checks passed
@xavierlacot xavierlacot deleted the fix/css-level-3-selectors branch July 31, 2024 12:54
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants