Skip to content

Commit fd3c4e6

Browse files
authored
Merge pull request #1013 from xavierlacot/fix/css-level-3-selectors
Allow CSS level 3 selectors for classes and ids in the attributes extension
2 parents fd45b92 + d24a759 commit fd3c4e6

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

src/Extension/Attributes/Util/AttributesHelper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
*/
2424
final class AttributesHelper
2525
{
26-
private const SINGLE_ATTRIBUTE = '\s*([.#][_a-z0-9-]+|' . RegexHelper::PARTIAL_ATTRIBUTENAME . RegexHelper::PARTIAL_ATTRIBUTEVALUESPEC . ')\s*';
26+
private const SINGLE_ATTRIBUTE = '\s*([.]-?[_a-z]\S*|[#]\S+|' . RegexHelper::PARTIAL_ATTRIBUTENAME . RegexHelper::PARTIAL_ATTRIBUTEVALUESPEC . ')\s*';
2727
private const ATTRIBUTE_LIST = '/^{:?(' . self::SINGLE_ATTRIBUTE . ')+}/i';
2828

2929
/**
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<p class="some-class(value)">Some text</p>
2+
<p class="some-class(value)">Some text</p>
3+
<p class="-hello">Some text</p>
4+
<p class="smile-😎 some-class">Some text</p>
5+
<p id="smile-😎">Some text</p>
6+
<p id="smile-😎">Some text</p>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{class="some-class(value)"}
2+
Some text
3+
4+
{.some-class(value)}
5+
Some text
6+
7+
{.-hello}
8+
Some text
9+
10+
{.smile-😎 .some-class}
11+
Some text
12+
13+
{id="smile-😎"}
14+
Some text
15+
16+
{#smile-😎}
17+
Some text

0 commit comments

Comments
 (0)