blob: 00d4556e1b22d3657ddc92db94593f5be970d1bf [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
<title>CSS 2.1 Test Suite: dynamic changes to 'counter-increment'</title>
<link rel="help" href="http://www.w3.org/TR/CSS21/generate.html#counters">
<link rel="help" href="http://www.w3.org/TR/CSS21/generate.html#propdef-content">
<link rel="help" href="http://www.w3.org/TR/CSS21/syndata.html#counter">
<meta http-equiv="Content-Script-Type" content="text/javascript"></meta>
<style type="text/css">
body { white-space: nowrap; }
#test, .reset { counter-reset: c; }
.increment:before { content: counters(c, ".") "-"; }
.increment { counter-increment: c; }
</style>
<script type="text/javascript">
function run() {
if (window.testRunner) {
testRunner.dumpAsText();
// This call ensures the layout happened before we modify the DOM tree.
window.internals.counterValue(document.getElementById("span1"));
}
var t = document.getElementById("test");
t.removeChild(t.childNodes.item(1));
if (window.testRunner) {
testElement = document.getElementById("test");
console = document.getElementById("console");
spanList = testElement.getElementsByTagName("span");
for (i = 0; i < spanList.length; ++i ) {
newSpanElement = document.createElement("span");
newSpanElement.innerText = window.internals.counterValue(document.getElementById(spanList.item(i).getAttribute("id")));
if (newSpanElement.innerText.length)
newSpanElement.innerText = newSpanElement.innerText + "-";
console.appendChild(newSpanElement);
}
}
}
</script>
</head>
<body onload="run();">
<p>The following two lines should be the same:</p>
<div id="test"><span id="span1" class="increment"></span><span id="span2" class="reset"></span><span id="span3" class="increment"></span><span id="span4" class="increment"></span></div>
<div id="reference">1-2-3-</div>
<hr>
<div id="console"/>
</body>
</html>