12 content:
"-" counter(i);
20 if (window
.testRunner
) {
21 testRunner
.dumpAsText();
22 testRunner
.waitUntilDone();
25 function insertAuto(i
) {
26 // We need to use the selection or we cannot reproduce this bug!
27 var selection
= window
.getSelection();
28 var container
= document
.getElementById("container");
29 selection
.collapse(container
.firstChild
, 0);
30 if (selection
.rangeCount
> 0) {
31 var newElement
= document
.createElement('div');
32 newElement
.id
= 'div' + i
;
33 //newElement.innerHTML = '<span"> - i:' + (6 - i) + '</span>';
34 var node
= selection
.getRangeAt(0).startContainer
.parentNode
.parentNode
;
35 node
.parentNode
.insertBefore(newElement
, node
.nextSibling
);
39 function dumpCounters()
41 var spanList
= document
.getElementsByTagName("div");
43 for (var i
= 0; i
< spanList
.length
; ++i
) {
44 var divItem
= spanList
.item(i
);
46 counters
+= window
.internals
.counterValue(document
.getElementById(divItem
.getAttribute("id")));
47 counters
+= divItem
.textContent
;
49 document
.getElementById("container").innerHTML
= counters
;
50 testRunner
.notifyDone();
55 for (var i
= 0; i
< 5; ++i
)
58 setTimeout("dumpCounters()", 0);
61 window
.addEventListener("load", test
, false);
65 <p>Bug
<a href=
"https://bugs.webkit.org/show_bug.cgi?id=38291">38291</a> - CSS counters in :before pseudo-elements do not always update
</p>
66 <p>The following two lines should be the same:
</p>
68 <div id=
"container"><span>-
</span></div>