- Issue created by @b.khouy
- Merge request !198issue-3473393: allow hyphens in attribute props names and values β (Merged) created by b.khouy
- Issue was unassigned.
- Status changed to Needs review
2 months ago 5:14pm 10 September 2024 -
pdureau β
committed 0e3d171c on 2.0.x authored by
b.khouy β
Issue #3473393 by b.khouy: Allow hyphens in attributes props' names and...
-
pdureau β
committed 0e3d171c on 2.0.x authored by
b.khouy β
- Status changed to Fixed
2 months ago 6:03pm 10 September 2024 - π«π·France pdureau Paris
Thanks Brahim.
$attr_name = "[a-zA-Z\-]+";
: can yo uupdate$double_quoted_value = '"[\s\w\-]*"';
- π²π¦Morocco b.khouy π²π¦ Morocco
@pdureau
Can we reopen this issue ?
We need to account for all special characters used in Tailwind.
Here are some examples of Tailwind classes:- bg-blue-500
- hover:bg-blue-500
- w-1/2
- w-1.5
- text-[16px]
- bg-[#ff5733]
- [&_img]:rounded
- [&_>p]:text-primary
- π«π·France pdureau Paris
Let's create another issue for beta2 if we can do that today.
So, we need to replace
\s\w\-
in$double_quoted_value = '"[\s\w\-]*"';
by something catching all characters except:- double quotes, because it is our delimiter
- https://html.spec.whatwg.org/#syntax-ambiguous-ampersand
- something else?
- π²π¦Morocco b.khouy π²π¦ Morocco
@pdureau
Yes, this applies only to the regex for double-quoted values (the attribute name regex is fine). Here's a regex that includes only the allowed special characters:$double_quoted_value = '"[\s\w\-_:&\[\]\/>\*]*"';
I will create another issue for that.
- π«π·France pdureau Paris
so you prefer to opt-in the expecting characters rather than opt-out the forbidden characters?
- π²π¦Morocco b.khouy π²π¦ Morocco
Yes, because we know the specific list of allowed special characters in Tailwind, it's easier to define that list explicitly rather than managing all the other forbidden special characters.
Here is the related issue: [2.0.0-beta2] The regex for attribute (values) props should allow all Tailwind allowed special characters π [2.0.0-beta2] The regex for attribute (values) props should allow all Tailwind allowed special characters Needs work
- Status changed to Fixed
2 months ago 7:24pm 15 September 2024