Say you have a CSS 2.1 counter like
ol {
counter-reset: section;
list-style-type: none;
}
li:before {
counter-increment: section;
content: counters(section, ".") " ";
}
<ol>
<li>itemA</li> <!-- 1 -->
<li>itemB <!-- 2 -->
<ol>
<li>itemC</li> <!-- 2.1 -->
<li id="foo">itemD</li> <!-- 2.2 -->
(see https://developer.mozilla.org/en/CSS_Counters "nesting counters")
Is there a way to read/get the :before.content
("2.2" in this case) for <li id="foo">
in JavaScript?
Edit: In my case a Mozilla-only solution would suffice. But there really seems to be no way to access this information. At least I didn't find any at https://developer.mozilla.org/en/CSS_Counters ff.