[Bug 24644] li should provide DOM interface to its value representation

https://www.w3.org/Bugs/Public/show_bug.cgi?id=24644

--- Comment #3 from Michael Cordover <w3c@mjec.net> ---
(In reply to Silvia Pfeiffer from comment #2)
> (In reply to Michael Cordover from comment #0)
> >
> > The most obvious use case for this property is cross-referencing in
> > documents, for example where paragraphs are numbered.
> 
> Michael, could you explain your use case in a bit more detail?
> 
> In the discussion in bug 24645 the suggestion was to compute the ordinal
> value of a list item from all the information available in the DOM. It's
> only a few lines of code (basically: ol.childNodes and then count only those
> with tagName="LI"). Why would that not be sufficient for you?

There are a couple of issues I have with this. One is that it's not quite that
simple: you need to also take into account ol.start at least, plus ol.reversed
and any other innovations in future specs. To get the rendered value you also
have to consider the style.

I also don't think it's the responsibility of the content author to replicate
work already done by the UA.

Most importantly though the information presented by the UA has semantic value.
That's the basis for the distinction between ul and ol. I think that semantic
information should be DOM-accessible as a matter of principle.

In terms of use case, I'm thinking about cross-referencing in documents e.g.
"refer to clause X" scenarios. For example:

HTML:
  <ol>
    <li>A legal clause</li>
    <li id="c">Another legal clause about copyright</li>
    <li>Except in accordance with <a class="xref" href="#c">the copyright
clause</a>...</li>
  </ol>

JS:
  var x = document.getElementsByClassName("xref")[0];
  x.textContent = "clause " +
document.getElementById(x.href.substring(1)).ordinalValue.toString();

-- 
You are receiving this mail because:
You are the QA Contact for the bug.

Received on Tuesday, 25 February 2014 04:56:50 UTC