No Code Attached Yet bug
avatar aschkenasy
aschkenasy
12 Apr 2022

class name value throws error Invalid field: Link Class

That is because it is an invalid class

https://www.w3.org/TR/CSS21/syndata.html#characters

Originally posted by @brianteeman in #37529 (comment)

avatar aschkenasy aschkenasy - open - 12 Apr 2022
avatar joomla-cms-bot joomla-cms-bot - change - 12 Apr 2022
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 12 Apr 2022
avatar brianteeman
brianteeman - comment - 12 Apr 2022

??

avatar aschkenasy
aschkenasy - comment - 12 Apr 2022

that should mean that escaped characters should be allowed as class names.
However, escaping the @ still yields the same error

avatar brianteeman
brianteeman - comment - 12 Apr 2022

Forgive me for not being a mind reader.

avatar aschkenasy
aschkenasy - comment - 12 Apr 2022

@brianteeman github did this automatically... sorry

avatar aschkenasy aschkenasy - change - 12 Apr 2022
Title
> class name value throws error Invalid field: Link Class
[4.1] menu item link calss doesn't accept @ - cont. #37529
avatar aschkenasy aschkenasy - edited - 12 Apr 2022
avatar aschkenasy aschkenasy - change - 12 Apr 2022
Title
[4.1] menu item link calss doesn't accept @ - cont. #37529
[4.1] menu item link class doesn't accept @ - cont. #37529
avatar aschkenasy aschkenasy - edited - 12 Apr 2022
avatar aschkenasy
aschkenasy - comment - 12 Apr 2022

Steps to reproduce the issue

try to add uk-visible@m as link class to any menu item

Expected result

uk-visible@m should be stored

Actual result

class name value throws error Invalid field: Link Class

System information (as much as possible)

j4.1.2

avatar brianteeman
brianteeman - comment - 12 Apr 2022

a css clsass with @ in the name is invalid. Doesnt matter what you escape it with it is not valid.

Just try it with a basic html page and you will see it doess not work

avatar drmenzelit
drmenzelit - comment - 12 Apr 2022

If you write the classes with a escape, it works
.re\@d { color: red; } .uk-visible\@m { color: pink; }

I tried directly in the browser, I inserted a class with @ on an element and created the css definition, the browser added automatically the \ symbol

avatar aschkenasy
aschkenasy - comment - 12 Apr 2022

a css clsass with @ in the name is invalid. Doesnt matter what you escape it with it is not valid.

Just try it with a basic html page and you will see it doess not work

the w3 reference seems to talk about @ within a css file not as a class name in html

avatar simbus82
simbus82 - comment - 12 Apr 2022

A class name with a @, escaped or not, in a HTML5 Class attribute is not permitted.
So you can't insert in a "class" field (for example a menu link class) in Joomla because it isn't a field that generate some CSS, but it fills an HTML Class attribute in the HTML source.

Ex:
<span class="red@2">NOT PERMITTED</span>

avatar aschkenasy
aschkenasy - comment - 12 Apr 2022

A class name with a @, escaped or not, in a HTML5 Class attribute is not permitted. So you can't insert in a "class" field (for example a menu link class) in Joomla because it isn't a field that generate some CSS, but it fills an HTML Class attribute in the HTML source.

Ex: <span class="red@2">NOT PERMITTED</span>
@simbus82 this is directly described in the w3 doc which @brianteeman referred me to. and it specificaly states that

Identifiers can also contain escaped characters and any ISO 10646 character as a numeric code (see next item). For instance, the identifier "B&W?" may be written as "B&W?" or "B\26 W\3F".

source: https://www.w3.org/TR/CSS21/syndata.html#characters

avatar brianteeman
brianteeman - comment - 12 Apr 2022

so did you try with a numeric code

avatar aschkenasy
aschkenasy - comment - 12 Apr 2022

@brianteeman yup. same error
apparently it strips everything not alphanumeric

avatar brianteeman
brianteeman - comment - 12 Apr 2022

Not suprised - just wanted to be ceertain.

I personally still say it should not be valid to use an @ in the name of a class but I guess if someone is able to modify the cssvalidation rule in a secure way then it could be fixed.

Doesnt seem even a low priority

avatar aschkenasy
aschkenasy - comment - 12 Apr 2022

@brianteeman totally agree on the priority level.

avatar chmst chmst - change - 17 Feb 2023
Labels Added: bug
avatar chmst chmst - labeled - 17 Feb 2023
avatar brianteeman
brianteeman - comment - 10 Aug 2023

Can be closed see #41332

avatar alikon alikon - change - 10 Aug 2023
Status New Closed
Closed_Date 0000-00-00 00:00:00 2023-08-10 07:47:22
Closed_By alikon
avatar alikon alikon - close - 10 Aug 2023
avatar alikon
alikon - comment - 10 Aug 2023

please test #41332

Add a Comment

Login with GitHub to post a comment