Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / css / counters / counter-before-content-not-incremented.html
bloba100c3403c13f8ed086adaf7fd1c67effa8fbd62
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <style>
5 body
7 counter-reset: i 0;
10 div:before
12 content: "-" counter(i);
13 counter-increment: i;
15 div {
16 display:inline;
18 </style>
19 <script>
20 if (window.testRunner) {
21 testRunner.dumpAsText();
22 testRunner.waitUntilDone();
25 function insertAuto(i) {
26 // We need to use the selection or we cannot reproduce this bug!
27 var selection = window.getSelection();
28 var container = document.getElementById("container");
29 selection.collapse(container.firstChild, 0);
30 if (selection.rangeCount > 0) {
31 var newElement = document.createElement('div');
32 newElement.id = 'div' + i;
33 //newElement.innerHTML = '<span"> - i:' + (6 - i) + '</span>';
34 var node = selection.getRangeAt(0).startContainer.parentNode.parentNode;
35 node.parentNode.insertBefore(newElement, node.nextSibling);
39 function dumpCounters()
41 var spanList = document.getElementsByTagName("div");
42 var counters = '';
43 for (var i = 0; i < spanList.length; ++i ) {
44 var divItem = spanList.item(i);
45 counters += '-';
46 counters += window.internals.counterValue(document.getElementById(divItem.getAttribute("id")));
47 counters += divItem.textContent;
49 document.getElementById("container").innerHTML = counters;
50 testRunner.notifyDone();
53 function test()
55 for (var i = 0; i < 5; ++i)
56 insertAuto(i);
57 if (testRunner) {
58 setTimeout("dumpCounters()", 0);
61 window.addEventListener("load", test, false);
62 </script>
63 </head>
64 <body>
65 <p>Bug <a href="https://bugs.webkit.org/show_bug.cgi?id=38291">38291</a> - CSS counters in :before pseudo-elements do not always update</p>
66 <p>The following two lines should be the same:</p>
67 <p>-1--2-3-4-5-6</p>
68 <div id="container"><span>-</span></div>
69 </body>
70 </html>