counter-increment-001.xht (1298B)
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> 2 <html xmlns="http://www.w3.org/1999/xhtml"> 3 <head> 4 <title>CSS Test: dynamic changes to 'counter-increment'</title> 5 <link rel="author" title="L. David Baron" href="https://dbaron.org/"/> 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-content"/> 8 <link rel="help" href="http://www.w3.org/TR/CSS21/syndata.html#counter"/> 9 <meta name="flags" content="dom"/> 10 <meta http-equiv="Content-Script-Type" content="text/javascript"/> 11 <style type="text/css"> 12 13 body { white-space: nowrap; } 14 15 16 #test, .reset { counter-reset: c; } 17 .increment:before { content: counters(c, ".") "-"; } 18 .increment { counter-increment: c; } 19 20 </style> 21 <script type="text/javascript"> 22 23 function run() { 24 var t = document.getElementById("test"); 25 t.removeChild(t.childNodes.item(1)); 26 } 27 28 </script> 29 </head> 30 <body onload="setTimeout('run()', 0)"> 31 32 <p>The following two lines should be the same:</p> 33 34 <div id="test"><span class="increment"></span><span class="increment">FAIL-</span><span class="increment"></span><span class="increment"></span></div> 35 36 <div id="reference">1-2-3-</div> 37 38 </body> 39 </html>