Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / inspector-protocol / dom / dom-ns-attr-modified.html
blob61ca83e5fbe75bdb5cd74de9985e193fd9c599e0
1 <html>
2 <head>
3 <script type="text/javascript" src="../../http/tests/inspector-protocol/inspector-protocol-test.js"></script>
4 <script>
5 function test()
7 var rootNodeId;
9 InspectorTest.sendCommand("DOM.getDocument", {}, onGotDocument);
11 function onGotDocument(msg)
13 rootNodeId = msg.result.root.nodeId;
14 getMainNodeId();
17 function getMainNodeId(next)
19 InspectorTest.sendCommand("DOM.querySelector", { "nodeId": rootNodeId, "selector": "#main" }, onMainNodeLoaded);
22 function onMainNodeLoaded()
24 InspectorTest.log("");
25 InspectorTest.log("Changing attribute...");
26 InspectorTest.eventHandler["DOM.attributeModified"] = onAttributeModified;
27 var expression = "";
28 expression += "var element = document.getElementById('main');\n";
29 expression += "element.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', 'changed-url');\n";
30 InspectorTest.sendCommand("Runtime.evaluate", { expression: expression });
33 function onAttributeModified(msg)
35 var result = msg.params;
36 InspectorTest.log("Modified attribute: '" + result.name + "'='" + result.value + "'");
38 InspectorTest.log("Removing attribute...");
39 InspectorTest.eventHandler["DOM.attributeRemoved"] = onAttributeRemoved;
40 var expression = "";
41 expression += "var element = document.getElementById('main');\n";
42 expression += "element.removeAttribute('xlink:href', 'changed-url');\n";
43 InspectorTest.sendCommand("Runtime.evaluate", { expression: expression });
46 function onAttributeRemoved(msg)
48 var result = msg.params;
49 InspectorTest.log("Removed attribute: '" + result.name + "'");
50 InspectorTest.completeTest();
53 </script>
54 </head>
55 <body onload="runTest()">
56 <p>Test that DOM events have correct parameters for attribute with namespace in XML document.</p>
57 <svg>
58 <a id="main" xlink:href="http://localhost">link</a>
59 </svg>
60 </body>
61 </html>