| <html> |
| <head> |
| <script type="text/javascript" src="../http/tests/inspector-protocol/resources/protocol-test.js"></script> |
| <script> |
| |
| function test() |
| { |
| var rootNodeId; |
| var nodeId; |
| |
| InspectorTest.eventHandler["DOM.attributeModified"] = onAttributeModified; |
| |
| InspectorTest.sendCommand("DOM.getDocument", {}, onGotDocument); |
| |
| function onGotDocument(msg) |
| { |
| if (msg.error) { |
| InspectorTest.log(msg.error.message); |
| InspectorTest.completeTest(); |
| return; |
| } |
| rootNodeId = msg.result.root.nodeId; |
| getMainNodeId(); |
| } |
| |
| function getMainNodeId(next) |
| { |
| InspectorTest.sendCommand("DOM.querySelector", { "nodeId": rootNodeId, "selector": "#main" }, onQuery); |
| function onQuery(msg) |
| { |
| if (!checkError(msg)) |
| return; |
| nodeId = msg.result.nodeId; |
| onGotMainNodeId(); |
| } |
| } |
| |
| function onGotMainNodeId() |
| { |
| InspectorTest.log("Original attributes:"); |
| dumpMainElementAttributes(onDumpedOriginal); |
| } |
| |
| function onDumpedOriginal() |
| { |
| InspectorTest.sendCommand("DOM.setAttributesAsText", { "nodeId": nodeId, "name": "viewBox", "text": "viewBox=\"0 0 120 120\"" }); |
| } |
| |
| function onAttributeModified(msg) { |
| var result = msg.params; |
| InspectorTest.log("Modified attribute:"); |
| InspectorTest.log(result.name + "=" + result.value); |
| InspectorTest.completeTest(); |
| } |
| |
| function dumpMainElementAttributes(next) |
| { |
| InspectorTest.sendCommand("DOM.getAttributes", { "nodeId": nodeId }, onAttributes); |
| |
| function onAttributes(msg) |
| { |
| if (!checkError(msg)) |
| return; |
| var array = msg.result.attributes; |
| for (var i = 0; i < array.length; i += 2) |
| InspectorTest.log(array[i] + "=" + array[i + 1]); |
| next(); |
| } |
| } |
| |
| function checkError(msg) |
| { |
| if (msg.error) { |
| InspectorTest.log(msg.error.message); |
| InspectorTest.completeTest(); |
| return false; |
| } |
| return true; |
| } |
| } |
| </script> |
| </head> |
| <body onload="runTest()"> |
| Test that DOM attribute case is preserved when modified in XML documents. |
| <svg id="main" xmlns="http://www.w3.org/2000/svg" width="600" height="500" viewBox="0 0 100 120" /> |
| </body> |
| </html> |