Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / css / counters / adding-nodes.html
blob77e65f9cfb0f01e60aeb6fed674f3c06437a6f21
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>Adding nodes that affect the CSS counter tree</title>
5 <link rel="author" href="mailto:carol.szabo@nokia.com" title="Carol Szabo">
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.testRunner) {
20 testRunner.dumpAsText();
21 testRunner.waitUntilDone();
24 function run() {
25 testElement = document.getElementById("test");
26 newSpanElement = document.createElement("span");
27 newSpanElement.setAttribute("class","increment");
28 newSpanElement.setAttribute("id","newNode");
29 testElement.insertBefore(newSpanElement, testElement.firstChild);
30 if (window.testRunner) {
31 console = document.getElementById("console");
32 spanList = testElement.getElementsByTagName("span")
33 for (i = 0; i < spanList.length; ++i ) {
34 newSpanElement = document.createElement("span");
35 id = spanList.item(i).getAttribute("id");
36 if (id != null)
37 newSpanElement.innerText = window.internals.counterValue(document.getElementById(id));
38 if (newSpanElement.innerText.length)
39 newSpanElement.innerText = newSpanElement.innerText + "-";
40 console.appendChild(newSpanElement);
42 testElement.parentNode.removeChild(testElement);
43 testElement = document.getElementById("reference");
44 testElement.innerHTML = testElement.innerHTML.replace(/<b>a<u>b<\/u><\/b>/g,"");
45 testRunner.notifyDone();
48 </script>
49 </head><body onload="setTimeout('run()', 0)">
50 <p>The following two lines should have the same content:</p>
51 <div id="test"><b>a<u>b</u></b><b>a<u>b</u></b><span id="parent"><b>a<u>b</u></b><span id="rootOne" class="increment"/><b>a<u>b</u></b></span><b>a<u>b</u></b><span id="rootTwo" class="reset"><b>a<u>b</u></b></span><b>a<u>b</u></b><span id="r2c1" class="use"><b>a<u>b</u></b><span id="nrreset" class="reset"><b>a<u>b</u></b><span id="r3c1" class="increment"></span><b>a<u>b</u></b></span></span></div>
52 <div id="reference">1-<b>a<u>b</u></b><b>a<u>b</u></b><b>a<u>b</u></b>2-<b>a<u>b</u></b><b>a<u>b</u></b><b>a<u>b</u></b><b>a<u>b</u></b>2.0-<b>a<u>b</u></b><b>a<u>b</u></b>2.0.1-<b>a<u>b</u></b></div>
53 <hr>
54 <div id="console"></div>
55 </body></html>