Initialize Tizen 2.3
[framework/web/webkit-efl.git] / LayoutTests / traversal / moz-bug590771.html
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 Test adapted from http://mxr.mozilla.org/mozilla-central/source/content/base/test/test_bug590771.html
5
6 https://bugzilla.mozilla.org/show_bug.cgi?id=590771
7 -->
8 <head>
9   <title>Test for Bug 590771</title>
10 </head>
11 <body>
12 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=590771">Mozilla Bug 590771</a>
13 <p id="display"></p>
14 <pre id="test">
15 <script type="application/javascript">
16
17 if (window.testRunner)
18   testRunner.dumpAsText();
19
20 /** Test for Bug 590771 **/
21
22 function test1()
23 {
24   var attr = document.createAttribute("foo");
25   attr.value = "bar";
26   var ni = document.createNodeIterator(attr, -1, null, false);
27   ni.nextNode();
28   ni.nextNode();
29   console.log("test1: iterator should be on the first child attribute: " + (ni.referenceNode === attr.firstChild));
30
31   attr.removeChild(attr.firstChild);
32   console.log("test1: iterator should be on the attribute now: " + (ni.referenceNode === attr));
33 }
34
35 function test2()
36 {
37   var attr = document.createAttribute("foo");
38   attr.value = "bar";
39   var ni = document.createNodeIterator(attr, -1, null, false);
40   ni.nextNode();
41   ni.nextNode();
42   console.log("test2: iterator should be on the first child attribute: " + (ni.referenceNode === attr.firstChild));
43
44   attr.value = "";
45   console.log("test2: iterator should be on the attribute now: " + (ni.referenceNode === attr));
46 }
47
48 function test3()
49 {
50   var attr = document.createAttribute("foo");
51   attr.value = "bar";
52   var node = document.createElement("div");
53   node.setAttributeNode(attr);
54   var ni = document.createNodeIterator(attr, -1, null, false);
55   ni.nextNode();
56   ni.nextNode();
57   console.log("test3: iterator should be on the first child attribute: " + (ni.referenceNode === attr.firstChild));
58
59   node.setAttribute("foo", "");
60   console.log("test3: iterator should be on the attribute now: " + (ni.referenceNode === attr));
61 }
62
63 test1();
64 test2();
65 test3();
66
67 </script>
68 </pre>
69 </body>
70 </html>