2009-12-08 Carol Szabo <carol.szabo@nokia.com>
[WebKit-https.git] / LayoutTests / fast / css / counters / nesting.html
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-content">
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-Style-Type" content="text/css">
11     <meta http-equiv="Content-Script-Type" content="text/javascript">
12     <style type="text/css">
13         body { white-space: nowrap; }
14         .reset { counter-reset: c; }
15         .increment:before, .use:before { content: counters(c, ".") "-"; }
16         .increment { counter-increment: c; }
17     </style>
18     <script type="text/javascript">
19         if (window.layoutTestController) {
20             layoutTestController.dumpAsText();
21             layoutTestController.waitUntilDone();
22         }
23
24         function run() {
25             if (window.layoutTestController) {
26                 testElement = document.getElementById("test");
27                 console = document.getElementById("console");
28                 spanList = testElement.getElementsByTagName("span")
29                 for (i = 0; i < spanList.length; ++i ) {
30                     newSpanElement = document.createElement("span");
31                     newSpanElement.innerText =
32                     layoutTestController.counterValueForElementById(spanList.item(i).getAttribute("id"));
33                     if (newSpanElement.innerText.length)
34                         newSpanElement.innerText = newSpanElement.innerText + "- ";
35                     console.appendChild(newSpanElement);
36                 }
37                 layoutTestController.notifyDone();
38             }
39         }
40     </script>
41 </head><body onload="setTimeout('run()', 0)">
42     <p>The following two lines should have the same content:</p>
43     <div id="test">
44         <span id="root" class="reset">
45             <span id="dummy">
46                 <span id="reset1" style="counter-reset: c 1"></span>
47                 <span id="inc" class="increment"></span>
48                 <span id="user" class="use"></span>
49                 <span id="reset4" style="counter-reset: c 4"></span>
50                 <span id="inc2" class="increment"></span>
51             </span>
52             <span id="interesting" class="increment"></span>
53         </span>
54     </div>
55     <div id="reference">0.2- 0.2- 0.5- 1- </div>
56     <hr>
57     <div id="console"></div>
58 </body></html>