-
Notifications
You must be signed in to change notification settings - Fork 2k
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
FF82 CSS counter-reset spec fix #15666
Conversation
I think I have a suggestion here, but I want to make sure I understand completely. Here's the story (but correct me if I'm wrong):
This suggests two things:
Have I got it? |
I think so, but the story is all messed up in multiple threads. Which is why I asked for feedback from @MatsPalmgren |
Hey @hamishwillee, what's the status of this PR? |
@queengooborg Arrrrgggg. This PR adds a "negative subfeature" indicating some off-spec behaviour that was fixed in FF82 but which is still wrong on all other browsers. Daniel left this approved so I could merge it when/if I like. But I have been waiting on @MatsPalmgren to confirm my understanding. He is silent. I wonder if there is another way to ping him. So we could merge this if you like as "likely to be correct" and certainly more correct than the last version. But you take a different view on negative subfeatures than Daniel, so perhaps you'd like that changed? I vacillate between liking and disliking them. FYI CSS counter reset is a minefield of misunderstanding; this was supposed to to be the mechanism for confirming how it all works. |
Let's go ahead and merge this as-is -- could we update this to use the |
b9d16a9
to
ea526d6
Compare
@queengooborg OK. I decided to make this a normal (not reversed) feature and apply mirroring. So now the feature looks like this.
In some ways this is more clear and concise. What firefox does is apply a reset to the current element, which will affect the element and any children it has (as they will get a counter seeded from it). However the other siblings are not reset - they keep the counter that they were given when their ancestor was created. This should be "good" now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this is LGTM!
counter-reset
has this example on the top. The results from Chrome, Firebox 81 and earlier, and everything else are on the left, the results from Firefox 82 are on the right.All of those chapters are h2 headings, and the
counter-reset
is applied to the second chapter "The pool of tears". In the context of just this example you'd think that the Chrome was correct and that the subsequent items should follow the siblings, but in fact it is in violation of spec.The reason is that each element gets a copy of the counter(s) of it's ancestors "first" if a counter is not explicitly applied. When you call
counter-reset
on an element you reset the counter on that specific element (create a new counter), not on every other (subsequent) elements (from comment in bug).So while the selected counter should change, the other siblings keep their original counter.
This might seem odd, but normally you'd call
counter-reset
on the parent, not on some arbitrary element mid way through.To get the more intuitive behaviour we're seeing in chrome you could call
counter-set
. My understanding is that this would set the counter on the element and on all subsequent elements in the same scope, though I could be wrong [ @MatsPalmgren could you confirm all that? i.e. both counter-reset and set statements ]Anyway, as this is a spec fix I have done this as a "negative subfeature", meaning that
use_reset_for_siblings
has been added as a deprecated subfeature that reflects the non-spec behaviour from the first version. This is still supported by Chrome et al, but Firefox has version_removed from FF82. Eventually all things should match the spec, and this would eventually be removed.I called this
use_reset_for_siblings
which I hope is a reasonable name for the bad behaviour, with description "Reset counter used instead of ancestor for subsequent sibling elements."`, Maybe better name would be "counter_reset_affects_siblings"?FYI
@ddbeck Thoughts? I really want @MatsPalmgren advice too. This is an ongoing source of confusion.