Open
Bug 1458761
Opened 7 years ago
Updated 3 years ago
:lang() arguments should be serialized as strings (with quotes)
Categories
(Core :: DOM: CSS Object Model, defect, P3)
Core
DOM: CSS Object Model
Tracking
()
UNCONFIRMED
People
(Reporter: cnardi, Unassigned)
Details
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3409.2 Safari/537.36
Steps to reproduce:
1. Set rule.selectorText to :lang(zh-CN)
2. Get rule.selectorText (for example in https://w3c-test.org/css/cssom/CSSStyleRule-set-selectorText.html)
Actual results:
rule.selectorText equals :lang(zh-CN)
Expected results:
rule.selectorText should equal :lang("zh-CN") (the test is incorrect as of now)
According to https://drafts.csswg.org/cssom/#serialize-a-simple-selector:
The serialization of a comma-separated list of each argument’s serialization as a string, preserving relative order.
This was changed in 2015 by https://github.com/w3c/csswg-drafts/commit/ccf619c645ef68a9ca996ebfe235ca28b6f9421f.
Reporter | ||
Comment 1•7 years ago
|
||
Safari does this correctly, but both Chrome/Firefox serialize it as an ident (no quotes). Unclear what Edge does.
Reporter | ||
Comment 2•7 years ago
|
||
This is probably blocked on bug 1121792, since without that change the serialization would create an invalid rule if reparsed.
If the spec says this, I'd argue that it shouldn't, since it violates the principle that serialization should be to the most compatible form.
Reporter | ||
Comment 4•7 years ago
|
||
(In reply to David Baron :dbaron: ⌚️UTC-7 from comment #3)
> If the spec says this, I'd argue that it shouldn't, since it violates the
> principle that serialization should be to the most compatible form.
I think it actually makes sense to do it per the spec, since otherwise you'd have to determine if each argument would be valid as an ident, and if not, serialize as a string. Seems easier just to serialize everything as a string (I actually brought up a similar issue with keyframe names at https://github.com/w3c/csswg-drafts/issues/2435).
Comment 5•7 years ago
|
||
(In reply to Chris Nardi from comment #4)
> (In reply to David Baron :dbaron: ⌚️UTC-7 from comment #3)
> > If the spec says this, I'd argue that it shouldn't, since it violates the
> > principle that serialization should be to the most compatible form.
>
> I think it actually makes sense to do it per the spec, since otherwise you'd
> have to determine if each argument would be valid as an ident, and if not,
> serialize as a string. Seems easier just to serialize everything as a string
> (I actually brought up a similar issue with keyframe names at
> https://github.com/w3c/csswg-drafts/issues/2435).
There's a similar slightly-related precedent here which is font-family. People expect font-family to sometimes be serialized without quotes, which is unfortunate, but then they don't always want the <ident> serialization. See bug 1384398 and more importantly bug 1434802...
I tend to prefer the simpler thing of serializing as strings if we can do it, assuming other people are fine with that.
Updated•7 years ago
|
Priority: -- → P3
Updated•3 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•