OLD | NEW |
| (Empty) |
1 <html> | |
2 <head> | |
3 <script type="text/javascript" src="../../http/tests/inspector-protocol/resource
s/inspector-protocol-test.js"></script> | |
4 <script> | |
5 function test() | |
6 { | |
7 var rootNodeId; | |
8 | |
9 InspectorTest.sendCommand("DOM.getDocument", {}, onGotDocument); | |
10 | |
11 function onGotDocument(msg) | |
12 { | |
13 rootNodeId = msg.result.root.nodeId; | |
14 getMainNodeId(); | |
15 } | |
16 | |
17 function getMainNodeId(next) | |
18 { | |
19 InspectorTest.sendCommand("DOM.querySelector", { "nodeId": rootNodeId, "
selector": "#main" }, onMainNodeLoaded); | |
20 } | |
21 | |
22 function onMainNodeLoaded() | |
23 { | |
24 InspectorTest.log(""); | |
25 InspectorTest.log("Changing attribute..."); | |
26 InspectorTest.eventHandler["DOM.attributeModified"] = onAttributeModifie
d; | |
27 var expression = ""; | |
28 expression += "var element = document.getElementById('main');\n"; | |
29 expression += "element.setAttributeNS('http://www.w3.org/1999/xlink', 'x
link:href', 'changed-url');\n"; | |
30 InspectorTest.sendCommand("Runtime.evaluate", { expression: expression }
); | |
31 } | |
32 | |
33 function onAttributeModified(msg) | |
34 { | |
35 var result = msg.params; | |
36 InspectorTest.log("Modified attribute: '" + result.name + "'='" + result
.value + "'"); | |
37 | |
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 }
); | |
44 } | |
45 | |
46 function onAttributeRemoved(msg) | |
47 { | |
48 var result = msg.params; | |
49 InspectorTest.log("Removed attribute: '" + result.name + "'"); | |
50 InspectorTest.completeTest(); | |
51 } | |
52 } | |
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> | |
OLD | NEW |