Skip to content

Commit

Permalink
Merge pull request #1013 from xavierlacot/fix/css-level-3-selectors
Browse files Browse the repository at this point in the history
Allow CSS level 3 selectors for classes and ids in the attributes extension
  • Loading branch information
colinodell authored Jul 22, 2024
2 parents fd45b92 + d24a759 commit fd3c4e6
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Extension/Attributes/Util/AttributesHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*/
final class AttributesHelper
{
private const SINGLE_ATTRIBUTE = '\s*([.#][_a-z0-9-]+|' . RegexHelper::PARTIAL_ATTRIBUTENAME . RegexHelper::PARTIAL_ATTRIBUTEVALUESPEC . ')\s*';
private const SINGLE_ATTRIBUTE = '\s*([.]-?[_a-z]\S*|[#]\S+|' . RegexHelper::PARTIAL_ATTRIBUTENAME . RegexHelper::PARTIAL_ATTRIBUTEVALUESPEC . ')\s*';
private const ATTRIBUTE_LIST = '/^{:?(' . self::SINGLE_ATTRIBUTE . ')+}/i';

/**
Expand Down
6 changes: 6 additions & 0 deletions tests/functional/Extension/Attributes/data/class_names.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<p class="some-class(value)">Some text</p>
<p class="some-class(value)">Some text</p>
<p class="-hello">Some text</p>
<p class="smile-😎 some-class">Some text</p>
<p id="smile-😎">Some text</p>
<p id="smile-😎">Some text</p>
17 changes: 17 additions & 0 deletions tests/functional/Extension/Attributes/data/class_names.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{class="some-class(value)"}
Some text

{.some-class(value)}
Some text

{.-hello}
Some text

{.smile-😎 .some-class}
Some text

{id="smile-😎"}
Some text

{#smile-😎}
Some text

0 comments on commit fd3c4e6

Please sign in to comment.