summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/dom/htmlcollection-backwards-subtree-iteration.html
blob: bc480b895086464fc3c4b82e9b92aa1a004ed9ee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<!DOCTYPE html>
<html>
<body>
<img id="1"><img id="2"><img id="3"><img id="4">
<script>

var errors = '';
var images = document.images;
for (var i = images.length; i > 0; i--) {
    images[0].class = 'foo';
    if (parseInt(images[i - 1].id) != i)
        errors += 'FAIL - Expected ' + i + ' but got ' + images[i - 1].id + '<br>';
    images[i - 1].class = 'foo';
}

if (window.testRunner)
    testRunner.dumpAsText();

document.body.innerHTML = 'Tests that HTMLCollection of a subtree (as opposed to direct children) can be iterated backwards.<br>'
+ 'There should be no console error and WebKit should not hit an assertion.<br><br>' + (errors ? errors : 'PASS');

</script>
</body>
</html>