OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> |
| 2 <html><head> |
| 3 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
| 4 <title>CSS Test: dynamic changes to 'counter-increment'</title> |
| 5 <link rel="author" href="http://dbaron.org/" title="L. David Baron"> |
| 6 <link rel="help" href="http://www.w3.org/TR/CSS21/generate.html#counters"> |
| 7 <link rel="help" href="http://www.w3.org/TR/CSS21/generate.html#propdef-cont
ent"> |
| 8 <link rel="help" href="http://www.w3.org/TR/CSS21/syndata.html#counter"> |
| 9 <meta content="dom" name="flags"> |
| 10 <meta http-equiv="Content-Script-Type" content="text/javascript"> |
| 11 <style type="text/css"> |
| 12 body { white-space: nowrap; } |
| 13 #test, .reset { counter-reset: c; } |
| 14 .increment:before { content: counters(c, ".") "-"; } |
| 15 .increment { counter-increment: c; } |
| 16 </style> |
| 17 <script type="text/javascript"> |
| 18 if (window.layoutTestController) { |
| 19 layoutTestController.dumpAsText(); |
| 20 layoutTestController.waitUntilDone(); |
| 21 } |
| 22 |
| 23 function run() { |
| 24 document.getElementById("one").setAttribute("class", "reset"); |
| 25 document.getElementById("two").removeAttribute("class"); |
| 26 if (window.layoutTestController) { |
| 27 testElement = document.getElementById("test"); |
| 28 console = document.getElementById("console"); |
| 29 spanList = testElement.getElementsByTagName("span") |
| 30 for (i = 0; i < spanList.length; ++i ) { |
| 31 newSpanElement = document.createElement("span"); |
| 32 newSpanElement.innerText = |
| 33 layoutTestController.counterValueForElementById(spanList.ite
m(i).getAttribute("id")); |
| 34 if (newSpanElement.innerText.length) |
| 35 newSpanElement.innerText = newSpanElement.innerText + "-
"; |
| 36 console.appendChild(newSpanElement); |
| 37 } |
| 38 layoutTestController.notifyDone(); |
| 39 } |
| 40 } |
| 41 </script> |
| 42 </head><body onload="setTimeout('run()', 0)"> |
| 43 <p>The following two lines should be the same:</p> |
| 44 <div id="test"><span id="span1" class="increment"></span><span id="span2"><s
pan class="reset" id="one"><span id="span4" class="increment"></span></span></sp
an><span id="span5" class="increment"></span><span id="span6"><span id="two"><sp
an id="span7" class="increment"></span></span></span><span id="span8" class="in
crement"></span></div> |
| 45 <div id="reference">1-1.1-2-3-4-</div> |
| 46 <div id="console" /> |
| 47 </body></html> |
OLD | NEW |