counter-increment-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-Style-Type" content="text/css">
11   <meta http-equiv="Content-Script-Type" content="text/javascript">
12   <style type="text/css">
13 
14   body { white-space: nowrap; }
15 
16 
17   #test, .reset { counter-reset: c; }
18   .increment:before, .use:before { content: counters(c, ".") "-"; }
19   .increment { counter-increment: c; }
20 
21   </style>
22   <script type="text/javascript">
23 
24   function run() {
25     document.getElementById("one").removeAttribute("class");
26 	document.getElementById("two").setAttribute("class", "increment");
27 	document.getElementById("three").setAttribute("style", "counter-increment: c");
28   }
29 
30   </script>
31  </head>
32  <body onload="setTimeout('run()', 0)">
33 
34  <p>The following two lines should be the same:</p>
35 
36  <div id="test"><span id="one" class="increment"></span><span><span class="reset"><span class="increment"></span><span id="two" class="increment"></span></span></span><span id="three" class="use"></span><span class="increment"></span></div>
37 
38  <div id="reference">0.1-0.2-1-2-</div>
39 
40  </body>
41 </html>