-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
<li> ordinal value definition is wrong when not directly inside an <ol> #1617
Comments
//not specifically markup, but it might be good to note the CSS implication |
Firefox says |
http://software.hixie.ch/utilities/js/live-dom-viewer/saved/4351 Chrome/Firefox don't renumber inside bare navs. Firefox messes up the numbering due to the nested element, but we already knew that. |
It's a bit interesting that <ol reversed>
<li>x</li>
<li value = 2>x</li>
<li>x</li>
<li>x</li>
</ol> gives (As always, my primary reaction to such edge cases is "why would anyone do such a thing" 😝 ) |
Gecko patch at https://bugzilla.mozilla.org/show_bug.cgi?id=1290813 (need to add reftests and things) |
Relevant tests https://github.com/w3c/web-platform-tests/blob/master/html/semantics/grouping-content/the-ol-element/reversed-1a.html (etc) They don't actually have |
FWIW Gecko opted to merge that, since it brings us closer to other engines (which do more sensible things), and that behavior is unspecced anyway. Perhaps we should have a "list owner" concept similar to "form owner" for the spec prose? Or simply a "set of child list elements" concept. "form owner" reminds me -- I wonder how reversed lists work when the user agent receives half a list. (Bit late here, will check tomorrow) |
Regarding partial loads, it seems to just renumber when it receives new |
@Manishearth I noticed that as you pointed out in #1617 (comment) there are a bunch of nice tests for this now. We should really get the spec fixed, and preferably fix #1911 at the same time (/cc @upsuper). Although maybe I'll tackle that first since it seems easier. Could you help us get started on writing a spec here? Maybe describe the algorithm you implemented in Gecko? |
Also, have you looked in to the case of elements that are not being rendered, and how they impact the numbering? Per http://jsbin.com/jekokitonu/edit?html,css,js,output it seems like only the being-rendered |
Yes, only rendered |
(sorry about the delay, missed this)
It's the same algorithm as the one for numbering, except:
So I do one traversal to count what I would number, and a second one to actually number them (this time obeying Perhaps we can spec it like this?
I suggest a note giving the example of the algorithm in Gecko or something would be helpful here to clarify things. |
Just an opinion... Why can't we have an algorithm similar to normal in case of
<ol reversed>
<li> x </li>
<li value = 5 > x </li>
<li> x </li>
<li> x </li>
</ol> 4,5,2,1 |
That probably makes sense, but that doesn't match browsers' current behavior. And unless you can convince browsers to take the risk of breaking existing content and change their behavior to yours, we are pretty much stuck on the current behavior. |
Closes whatwg#1911 and closes whatwg#1617.
(Previously discussed in #1610.)
To solve this, we need to amend the definition of ordinal value to work for all
<li>
s that render as numbered values. Right now it only works for those directly inside<ol>
s (as it references the ol "parent"), but examples like http://software.hixie.ch/utilities/js/live-dom-viewer/?saved=4349 and http://software.hixie.ch/utilities/js/live-dom-viewer/?saved=4350 shows that browsers render numbers for them even when they are not direct children.This seems subtle and will probably involve some investigation to find a good algorithm. Browsers are not interoperable, at least for the reverse case, so any algorithm which matches the majority is good.
Some test cases worth thinking about:
<ol>
s, but maybe also<ul>
s?)<li>
s, does that affect the counter?The text was updated successfully, but these errors were encountered: