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

really interesting!

I think that the "best way" for you to get the number of a LI is by
verifying which nth-child it is from its parent, although it is not very
trustful once the list may start in a different value. Also, in case there
is any (not valid) text node inside the ol, not inside any li, it would
interfere with this number!
I would even propose an increment to that.
The LI elements could offer on its API two properties, one for the actual
index of the list(1, 2, 3, ... n) and other to the rendered value(1, 2,
3...or I, II, III, IV, or A, B, C...etc).


On Thu, Feb 13, 2014 at 4:26 AM, <bugzilla@jessica.w3.org> wrote:

> https://www.w3.org/Bugs/Public/show_bug.cgi?id=24644
>
>             Bug ID: 24644
>            Summary: li should provide DOM interface to its value
>                     representation
>            Product: HTML WG
>            Version: unspecified
>           Hardware: PC
>                 OS: Windows NT
>             Status: NEW
>           Severity: enhancement
>           Priority: P2
>          Component: HTML5 spec
>           Assignee: dave.null@w3.org
>           Reporter: w3c@mjec.net
>         QA Contact: public-html-bugzilla@w3.org
>                 CC: mike@w3.org, public-html-admin@w3.org,
>                     public-html-wg-issue-tracking@w3.org
>
> (Apologies if this should have been filed against HTML.next)
>
> <li> children of <ol> (and less significantly <ul>) may have a list marker
> rendered next to them. For children of <ol> the value of this marker can
> be set
> explicitly with the value attribute.
>
> When the value is not set (including because it is not a child of <ol>) the
> user agent will automatically determine and render a marker, if applicable
> in
> accordance with the CSS rules applied to the element.
>
> The automatically determined (or rendered) value is not DOM-accessible.
>
> I propose that the DOM interface for li elements be expanded to include a
> new
> property:
>
>   readonly attribute Node? renderedValue;
>
> This would return an Element or Text node, being the automatically
> calculated
> value for that li (or null if no list marker is rendered).
>
> In the alternative, this could be only available for li children of ol
> elements:
>
>   readonly attribute long ordinalValue;
>
> being the ordinal value
> <
> http://www.w3.org/html/wg/drafts/html/master/grouping-content.html#ordinal-value
> >
> of the li element.
>
> My suggestion is that the value is readonly to simplify implementation.
>
> The most obvious use case for this property is cross-referencing in
> documents,
> for example where paragraphs are numbered.
>
> --
> You are receiving this mail because:
> You are on the CC list for the bug.
>
>


-- 
*Felipe N. Moura*
Senior Web Developer

Website:  http://felipenmoura.org
 Twitter:    @felipenmoura <http://twitter.com/felipenmoura>
LinkedIn: http://goo.gl/qGmq

Meet some of my projects:
BrazilJS Conference <http://braziljs.com.br/>  |  BrazilJS
Foundation<http://braziljs.org>
|  Power Polygon <http://github.com/braziljs/power-polygon>  |
TheWebMind<http://thewebmind.org/>  |
PHPDevBar<https://addons.mozilla.org/pt-BR/firefox/addon/php-developer-toolbar/>
---------------------------------
LinuxUser #508332
*Changing  the  world*  is the least I expect from  myself!

Received on Monday, 17 February 2014 13:02:34 UTC