counter-reset-002

dynamic changes to 'counter-increment'

WeasyPrint

This browser

Flags
dom

Source

 1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
 2 <html>
 3  <head>
 4   <title>CSS Test: dynamic changes to 'counter-increment'</title>
 5   <link rel="author" title="L. David Baron" href="http://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 	document.getElementById("one").setAttribute("class", "reset");
25     document.getElementById("two").removeAttribute("class");
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><span id="one"><span class="increment"></span></span></span><span class="increment"></span><span><span id="two" class="reset"><span class="increment"></span></span></span><span class="increment"></span></div>
35 
36  <div id="reference">1-1.1-2-3-4-</div>
37 
38  </body>
39 </html>