1 <!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.01//EN">
4 <title>CSS
2.1 Test Suite: dynamic changes to 'counter-increment'
</title>
5 <style type=
"text/css">
7 #test, .reset
{ counter-reset: c
; }
8 .increment:before { content: counters
(c
, ".") "-"; }
9 .increment { counter-increment: c
; }
12 <script src=
"../../../resources/js-test.js"></script>
13 <script type=
"text/javascript">
15 if (window
.testRunner
)
16 testRunner
.dumpAsText();
18 function checkCounterValuesBeforeChange()
20 debug('Before the dynamic change:');
21 shouldBe("window.internals.counterValue(document.getElementById('one'))", "'1'");
22 shouldBe("window.internals.counterValue(document.getElementById('three'))", "'2'");
23 shouldBe("window.internals.counterValue(document.getElementById('four'))", "'3'");
26 function checkCounterValuesAfterChange()
28 debug('After the dynamic change:');
29 shouldBe("window.internals.counterValue(document.getElementById('one'))", "'1'");
30 shouldBe("window.internals.counterValue(document.getElementById('two'))", "'2'");
31 shouldBe("window.internals.counterValue(document.getElementById('three'))", "'3'");
32 shouldBe("window.internals.counterValue(document.getElementById('four'))", "'4'");
35 debug('TEST COMPLETE');
36 // Eliminate confusing messages (counter values won't be dumped by dumpAsText).
37 var viewElement
= document
.getElementById("view");
38 viewElement
.parentNode
.removeChild(viewElement
);
43 if (window
.testRunner
)
44 checkCounterValuesBeforeChange();
46 var t
= document
.getElementById("test");
47 var s
= document
.createElement("span");
48 s
.setAttribute("class", "increment");
49 s
.setAttribute("id", "two");
50 s
.appendChild(document
.createTextNode("new-"));
51 t
.insertBefore(s
, t
.childNodes
.item(1));
53 if (window
.testRunner
)
54 checkCounterValuesAfterChange();
59 <body onload=
"run();">
61 <p>This is the WebKit version of
<a href=
"http://www.w3.org/Style/CSS/Test/CSS2.1/20061011/html4/t1204-increment-00-c-o.htm">CSS
2.1 Test Suite: dynamic changes to 'counter-increment'
</a>.
</p>
64 <p>The following two lines should be the same:
</p>
65 <div id=
"test"><span id=
"one" class=
"increment"></span><span id=
"three" class=
"increment"></span><span id=
"four" class=
"increment"></span></div>
66 <div id=
"reference">1-
2-new-
3-
4-
</div>
69 <div id=
"console"></div>