-
Notifications
You must be signed in to change notification settings - Fork 714
[css-lists] canonical property order of list-style. #2624
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi Emilio,
It is a bit confusing. A counter-style name is a custom identifier, and custom identifiers are defined like "if it can mess with other identifiers, it is invalid". There is the following at: https://www.w3.org/TR/css3-values/#identifier-value
Then, at: https://www.w3.org/TR/css-counter-styles-3/#at-ruledef-counter-style you have this:
So |
Hmm, the problem with that kind of thing is that it prevents you from adding keywords to list-style-position without potentially breaking code... Plus now you need to also make it invalid in the longhand, or then not serializing it in the shorthand. Seems strictly worse and more complicated than swapping the values to me... FF definitely allows you to write cc @upsuper |
But
Not mutually exclusive. Your proposal make things a bit more deterministic, but still potentially confusing to users. I do not have a strong opinion in favour or against it (like if that mattered), but still think that banning those two values would be a good idea. |
Apparently not, according to browser compatibility table at: https://developer.mozilla.org/en-US/docs/Web/CSS/@counter-style And my latest Chrome does not support the demo at: https://mdn.github.io/css-examples/counter-style-demo/ |
So far, I have been thinking here in terms of problems when parsing an author-specified shorthand, however when it concerns serializing:
Serialization should involve a sanity check of the individual values, that's what I do in my code (admittedly not for all shorthands) and I was assuming that browser people does the same. For example, in tests with real-world sites I found frequent cases where url() PNG images were set to background-color properties, which then bombs a blindly-produced shorthand. So my code checks for those cases.
That should not be a problem if you do not produce a shorthand with it (you could produce a shorthand plus the problematic property:value, or keep all the longhands in the serialization). Perhaps that should be the first thing to check out here. |
So, we have a precedent for putting Given that, I tend to think we should change css-counter-styles to remove that note and change the canonical order of cc @tabatkins |
(@emilio , thanks for the cross-reference, somehow I missed this issue when I opened #2724) The example I filed in the other issue I think is worth reproducing here for clarity
I'd be against reordering of the list-style shorthand as a solution. It's currently defined as If you want to change it to remove the ambiguity introduced by allowing First, the grammar is going to more complicated then necessary; something like Second, even with an unambiguous grammar it will remain confusing. An author seeing "list-style: inside outside" will have no idea what is going on without consulting the spec. Given so few browsers implement @counter-style at this stage, personally I feel the best solution is disallowing "inside" and "outside" as counter names. We already do it with "none" so there's precedent. Prevent authors from shooting themselves in the foot. The second best solution would be not allowing them to be referenced from the list-style shorthand property. As pointed out above, there is no ambiguity except in the |
I've mentioned before, there is precedent. The syntax of
which should allow free reordering of the terms, but |
There are plenty of property shorthands that restrict ordering: But if that is going to be the solution for |
FWIW, Firefox has been shipping the feature using this syntax for several years, and I don't think I heard any breakage caused by this change. |
By "this syntax", I mean |
(There are exceptions to this; if the font-family is "Bold New Font", then
I'm extremely convinced by this argument and thus am fine with it. ^_^ |
@upsuper I was just doing some testing in Firefox and Chrome, and have a further question.
<!DOCTYPE html>
<ul><li id=foo>foo<li id=bar>bar</ul>
<style>
#foo { list-style: none decimal; }
#bar { list-style: none url("https://www.xanthir.com/pony"); }
</style> #foo should show a decimal, and #bar should show a pony. This conflicts with the suggested treatment of custom list-style-type, which should treat the #bar rule as invalid (as the Both Firefox and Chrome disagree with this, in different ways - Firefox implements the current spec, showing decimal/pony. Chrome does the opposite, showing disc/pony. (I presume it just consumes greedily, and gives list-style-type priority, rather than the opposite.) Is this behavior change okay? |
I think this is unrelated to the syntax change, and it's a case of usage of In Gecko, what we do is, during parsing value of It seems to me this is the only reasonable behavior for handling It's probably not very common that a shorthand has multiple longhands which accept the same value outside the case of |
All right, it just seems odd that the built-in keyword has different behavior from a custom keyword. |
@upsuper Updated the spec to match your comment in #2624 (comment) wrt canonical order. Was there anything else that needed to be fixed? |
The syntax looks good. Read through the section of the shorthand, it seems there is current a paragraph describing how |
Test parsing, serialization and computed value for list-style and associated longhand properties. https://drafts.csswg.org/css-lists-3/#list-style-property list-style-image supports image, including gradients https://drafts.csswg.org/css-lists-3/#propdef-list-style-image Colors and lengths in gradients are computed in computed style results. w3c/csswg-drafts#4042 calcs giving negative radii are clamped to 0. list-style uses the new serialization order: list-style-position list-style-image list-style-type w3c/csswg-drafts#2624 w3c/csswg-drafts@8ac1376 symbolic is omitted in shortest serialization https://bugzilla.mozilla.org/show_bug.cgi?id=1560494
Update the list-style shorthand https://drafts.csswg.org/css-lists-3/#list-style-property to match spec change w3c/csswg-drafts#2624 w3c/csswg-drafts@8ac1376 Bug: 978433
Update the list-style shorthand https://drafts.csswg.org/css-lists-3/#list-style-property to match spec change w3c/csswg-drafts#2624 w3c/csswg-drafts@8ac1376 Bug: 978433
Update the list-style shorthand https://drafts.csswg.org/css-lists-3/#list-style-property to match spec change w3c/csswg-drafts#2624 w3c/csswg-drafts@8ac1376 Bug: 978433 Change-Id: I579c2272390487b429d5fe986c51cdd2041653d8
Update the list-style shorthand https://drafts.csswg.org/css-lists-3/#list-style-property to match spec change w3c/csswg-drafts#2624 w3c/csswg-drafts@8ac1376 Bug: 978433 Change-Id: I579c2272390487b429d5fe986c51cdd2041653d8
Update the list-style shorthand https://drafts.csswg.org/css-lists-3/#list-style-property to match spec change w3c/csswg-drafts#2624 w3c/csswg-drafts@8ac1376 Bug: 978433 Change-Id: I579c2272390487b429d5fe986c51cdd2041653d8
Update the list-style shorthand https://drafts.csswg.org/css-lists-3/#list-style-property to match spec change w3c/csswg-drafts#2624 w3c/csswg-drafts@8ac1376 The list-style shorthand is now <list-style-position> || <list-style-image> || <list-style-type> instead of <list-style-type> || <list-style-position> || <list-style-image> Firefox already supports the updated spec. Bug: 978433 Change-Id: I579c2272390487b429d5fe986c51cdd2041653d8
Update the list-style shorthand https://drafts.csswg.org/css-lists-3/#list-style-property to match spec change w3c/csswg-drafts#2624 w3c/csswg-drafts@8ac1376 The list-style shorthand is now <list-style-position> || <list-style-image> || <list-style-type> instead of <list-style-type> || <list-style-position> || <list-style-image> Firefox already supports the updated spec. Bug: 978433 Change-Id: I579c2272390487b429d5fe986c51cdd2041653d8
Update the list-style shorthand https://drafts.csswg.org/css-lists-3/#list-style-property to match spec change w3c/csswg-drafts#2624 w3c/csswg-drafts@8ac1376 The list-style shorthand is now <list-style-position> || <list-style-image> || <list-style-type> instead of <list-style-type> || <list-style-position> || <list-style-image> Firefox already supports the updated spec. Bug: 978433 Change-Id: I579c2272390487b429d5fe986c51cdd2041653d8
Update the list-style shorthand https://drafts.csswg.org/css-lists-3/#list-style-property to match spec change w3c/csswg-drafts#2624 w3c/csswg-drafts@8ac1376 The list-style shorthand is now <list-style-position> || <list-style-image> || <list-style-type> instead of <list-style-type> || <list-style-position> || <list-style-image> Firefox already supports the updated spec. Bug: 978433 Change-Id: I579c2272390487b429d5fe986c51cdd2041653d8
Update the list-style shorthand https://drafts.csswg.org/css-lists-3/#list-style-property to match spec change w3c/csswg-drafts#2624 w3c/csswg-drafts@8ac1376 The list-style shorthand is now <list-style-position> || <list-style-image> || <list-style-type> instead of <list-style-type> || <list-style-position> || <list-style-image> Firefox already supports the updated spec. Bug: 978433 Change-Id: I579c2272390487b429d5fe986c51cdd2041653d8
Update the list-style shorthand https://drafts.csswg.org/css-lists-3/#list-style-property to match spec change w3c/csswg-drafts#2624 w3c/csswg-drafts@8ac1376 The list-style shorthand is now <list-style-position> || <list-style-image> || <list-style-type> instead of <list-style-type> || <list-style-position> || <list-style-image> Firefox already supports the updated spec. Bug: 978433 Change-Id: I579c2272390487b429d5fe986c51cdd2041653d8
Update the list-style shorthand https://drafts.csswg.org/css-lists-3/#list-style-property to match spec change w3c/csswg-drafts#2624 w3c/csswg-drafts@8ac1376 The list-style shorthand is now <list-style-position> || <list-style-image> || <list-style-type> instead of <list-style-type> || <list-style-position> || <list-style-image> Firefox already supports the updated spec. Bug: 978433 Change-Id: I579c2272390487b429d5fe986c51cdd2041653d8
Update the list-style shorthand https://drafts.csswg.org/css-lists-3/#list-style-property to match spec change w3c/csswg-drafts#2624 w3c/csswg-drafts@8ac1376 The list-style shorthand is now <list-style-position> || <list-style-image> || <list-style-type> instead of <list-style-type> || <list-style-position> || <list-style-image> Firefox already supports the updated spec. Bug: 978433 Change-Id: I579c2272390487b429d5fe986c51cdd2041653d8
Update the list-style shorthand https://drafts.csswg.org/css-lists-3/#list-style-property to match spec change w3c/csswg-drafts#2624 w3c/csswg-drafts@8ac1376 The list-style shorthand is now <list-style-position> || <list-style-image> || <list-style-type> instead of <list-style-type> || <list-style-position> || <list-style-image> Firefox already supports the updated spec. Bug: 978433 Change-Id: I579c2272390487b429d5fe986c51cdd2041653d8
Update the list-style shorthand https://drafts.csswg.org/css-lists-3/#list-style-property to match spec change w3c/csswg-drafts#2624 w3c/csswg-drafts@8ac1376 The list-style shorthand is now <list-style-position> || <list-style-image> || <list-style-type> instead of <list-style-type> || <list-style-position> || <list-style-image> Firefox already supports the updated spec. Bug: 978433 Change-Id: I579c2272390487b429d5fe986c51cdd2041653d8
Update the list-style shorthand https://drafts.csswg.org/css-lists-3/#list-style-property to match spec change w3c/csswg-drafts#2624 w3c/csswg-drafts@8ac1376 The list-style shorthand is now <list-style-position> || <list-style-image> || <list-style-type> instead of <list-style-type> || <list-style-position> || <list-style-image> Firefox already supports the updated spec. Bug: 978433 Change-Id: I579c2272390487b429d5fe986c51cdd2041653d8
Update the list-style shorthand https://drafts.csswg.org/css-lists-3/#list-style-property to match spec change w3c/csswg-drafts#2624 w3c/csswg-drafts@8ac1376 The list-style shorthand is now <list-style-position> || <list-style-image> || <list-style-type> instead of <list-style-type> || <list-style-position> || <list-style-image> Firefox already supports the updated spec. Bug: 978433 Change-Id: I579c2272390487b429d5fe986c51cdd2041653d8
Update the list-style shorthand https://drafts.csswg.org/css-lists-3/#list-style-property to match spec change w3c/csswg-drafts#2624 w3c/csswg-drafts@8ac1376 The list-style shorthand is now <list-style-position> || <list-style-image> || <list-style-type> instead of <list-style-type> || <list-style-position> || <list-style-image> Firefox already supports the updated spec. Bug: 978433 Change-Id: I579c2272390487b429d5fe986c51cdd2041653d8
Update the list-style shorthand https://drafts.csswg.org/css-lists-3/#list-style-property to match spec change w3c/csswg-drafts#2624 w3c/csswg-drafts@8ac1376 The list-style shorthand is now <list-style-position> || <list-style-image> || <list-style-type> instead of <list-style-type> || <list-style-position> || <list-style-image> Firefox already supports the updated spec. Bug: 978433 Change-Id: I579c2272390487b429d5fe986c51cdd2041653d8 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1664093 Reviewed-by: Emil A Eklund <[email protected]> Commit-Queue: Eric Willigers <[email protected]> Cr-Commit-Position: refs/heads/master@{#672325}
Update the list-style shorthand https://drafts.csswg.org/css-lists-3/#list-style-property to match spec change w3c/csswg-drafts#2624 w3c/csswg-drafts@8ac1376 The list-style shorthand is now <list-style-position> || <list-style-image> || <list-style-type> instead of <list-style-type> || <list-style-position> || <list-style-image> Firefox already supports the updated spec. Bug: 978433 Change-Id: I579c2272390487b429d5fe986c51cdd2041653d8 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1664093 Reviewed-by: Emil A Eklund <[email protected]> Commit-Queue: Eric Willigers <[email protected]> Cr-Commit-Position: refs/heads/master@{#672325}
…d spec, a=testonly Automatic update from web-platform-tests CSS: list-style shorthand matches updated spec Update the list-style shorthand https://drafts.csswg.org/css-lists-3/#list-style-property to match spec change w3c/csswg-drafts#2624 w3c/csswg-drafts@8ac1376 The list-style shorthand is now <list-style-position> || <list-style-image> || <list-style-type> instead of <list-style-type> || <list-style-position> || <list-style-image> Firefox already supports the updated spec. Bug: 978433 Change-Id: I579c2272390487b429d5fe986c51cdd2041653d8 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1664093 Reviewed-by: Emil A Eklund <[email protected]> Commit-Queue: Eric Willigers <[email protected]> Cr-Commit-Position: refs/heads/master@{#672325} -- wpt-commits: b97414545be808a5236e579fab30cedbfc058a66 wpt-pr: 17526
…d spec, a=testonly Automatic update from web-platform-tests CSS: list-style shorthand matches updated spec Update the list-style shorthand https://drafts.csswg.org/css-lists-3/#list-style-property to match spec change w3c/csswg-drafts#2624 w3c/csswg-drafts@8ac1376 The list-style shorthand is now <list-style-position> || <list-style-image> || <list-style-type> instead of <list-style-type> || <list-style-position> || <list-style-image> Firefox already supports the updated spec. Bug: 978433 Change-Id: I579c2272390487b429d5fe986c51cdd2041653d8 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1664093 Reviewed-by: Emil A Eklund <[email protected]> Commit-Queue: Eric Willigers <[email protected]> Cr-Commit-Position: refs/heads/master@{#672325} -- wpt-commits: b97414545be808a5236e579fab30cedbfc058a66 wpt-pr: 17526
…d spec, a=testonly Automatic update from web-platform-tests CSS: list-style shorthand matches updated spec Update the list-style shorthand https://drafts.csswg.org/css-lists-3/#list-style-property to match spec change w3c/csswg-drafts#2624 w3c/csswg-drafts@8ac1376 The list-style shorthand is now <list-style-position> || <list-style-image> || <list-style-type> instead of <list-style-type> || <list-style-position> || <list-style-image> Firefox already supports the updated spec. Bug: 978433 Change-Id: I579c2272390487b429d5fe986c51cdd2041653d8 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1664093 Reviewed-by: Emil A Eklund <eaechromium.org> Commit-Queue: Eric Willigers <ericwilligerschromium.org> Cr-Commit-Position: refs/heads/master{#672325} -- wpt-commits: b97414545be808a5236e579fab30cedbfc058a66 wpt-pr: 17526 UltraBlame original commit: 0b9fd1a749861d2703af37d9caea9ea5699a1c1c
…d spec, a=testonly Automatic update from web-platform-tests CSS: list-style shorthand matches updated spec Update the list-style shorthand https://drafts.csswg.org/css-lists-3/#list-style-property to match spec change w3c/csswg-drafts#2624 w3c/csswg-drafts@8ac1376 The list-style shorthand is now <list-style-position> || <list-style-image> || <list-style-type> instead of <list-style-type> || <list-style-position> || <list-style-image> Firefox already supports the updated spec. Bug: 978433 Change-Id: I579c2272390487b429d5fe986c51cdd2041653d8 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1664093 Reviewed-by: Emil A Eklund <eaechromium.org> Commit-Queue: Eric Willigers <ericwilligerschromium.org> Cr-Commit-Position: refs/heads/master{#672325} -- wpt-commits: b97414545be808a5236e579fab30cedbfc058a66 wpt-pr: 17526 UltraBlame original commit: 0b9fd1a749861d2703af37d9caea9ea5699a1c1c
…d spec, a=testonly Automatic update from web-platform-tests CSS: list-style shorthand matches updated spec Update the list-style shorthand https://drafts.csswg.org/css-lists-3/#list-style-property to match spec change w3c/csswg-drafts#2624 w3c/csswg-drafts@8ac1376 The list-style shorthand is now <list-style-position> || <list-style-image> || <list-style-type> instead of <list-style-type> || <list-style-position> || <list-style-image> Firefox already supports the updated spec. Bug: 978433 Change-Id: I579c2272390487b429d5fe986c51cdd2041653d8 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1664093 Reviewed-by: Emil A Eklund <eaechromium.org> Commit-Queue: Eric Willigers <ericwilligerschromium.org> Cr-Commit-Position: refs/heads/master{#672325} -- wpt-commits: b97414545be808a5236e579fab30cedbfc058a66 wpt-pr: 17526 UltraBlame original commit: 0b9fd1a749861d2703af37d9caea9ea5699a1c1c
@upsuper Added a note,
|
…or ambiguous grammars. #2624 (comment)
The note seems rather vague to me, whereas |
list-style-type
accepts an arbitrary identifier via<counter-style>
, and thus should be last, since it can overlap with values oflist-style-position
.Otherwise serializing the property and reparsing could generated different results.
The text was updated successfully, but these errors were encountered: