Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / traversal / tree-walker-006.html
1 <html> 
2 <head>
3 <title>Traversal Test</title> 
4 </head> 
5 <body>
6
7   <h2>XML doc elements:</h2>
8   <div style="font-family: Courier; font-size: 14;">
9     <script type="text/javascript" charset="utf-8">
10
11     if (window.testRunner)
12         testRunner.dumpAsText();
13
14       var dataURL = 'resources/node-iterator-009-data.xml';
15       function fetchXML()
16       {
17         var request = new XMLHttpRequest();
18         request.open("GET", dataURL, false /* sync */);
19         request.overrideMimeType("application/xml");
20         request.send();
21
22         if (request.readyState == 4) {
23           // only if "OK"
24           if (request.status == 200 || (request.status == 0 && request.responseText.length > 0))
25               walkXML(request.responseXML);
26         }
27       }
28
29       function testNodeFiter(n)
30       {
31           if (n.tagName == 'studio') return NodeFilter.FILTER_SKIP;
32           return NodeFilter.FILTER_ACCEPT;
33       }
34
35       function walkXML(xmlDoc)
36       {
37         var iter = document.createTreeWalker(xmlDoc, NodeFilter.SHOW_ELEMENT, testNodeFiter, false);
38         var curNode;
39         while (curNode = iter.nextNode()) {
40           document.write('<h3>' + curNode.tagName + '</h3><p>' + curNode.textContent + '</p>');
41         }
42       }
43       fetchXML();
44
45     </script>
46   </div>
47 </body>
48 </html>