| 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 | |
| 6 function test() | |
| 7 { | |
| 8 var rootNodeId; | |
| 9 var nodeId; | |
| 10 | |
| 11 InspectorTest.eventHandler["DOM.attributeModified"] = onAttributeModified; | |
| 12 | |
| 13 InspectorTest.sendCommand("DOM.getDocument", {}, onGotDocument); | |
| 14 | |
| 15 function onGotDocument(msg) | |
| 16 { | |
| 17 if (msg.error) { | |
| 18 InspectorTest.log(msg.error.message); | |
| 19 InspectorTest.completeTest(); | |
| 20 return; | |
| 21 } | |
| 22 rootNodeId = msg.result.root.nodeId; | |
| 23 getMainNodeId(); | |
| 24 } | |
| 25 | |
| 26 function getMainNodeId(next) | |
| 27 { | |
| 28 InspectorTest.sendCommand("DOM.querySelector", { "nodeId": rootNodeId, "
selector": "#main" }, onQuery); | |
| 29 function onQuery(msg) | |
| 30 { | |
| 31 if (!checkError(msg)) | |
| 32 return; | |
| 33 nodeId = msg.result.nodeId; | |
| 34 onGotMainNodeId(); | |
| 35 } | |
| 36 } | |
| 37 | |
| 38 function onGotMainNodeId() | |
| 39 { | |
| 40 InspectorTest.log("Original attributes:"); | |
| 41 dumpMainElementAttributes(onDumpedOriginal); | |
| 42 } | |
| 43 | |
| 44 function onDumpedOriginal() | |
| 45 { | |
| 46 InspectorTest.sendCommand("DOM.setAttributesAsText", { "nodeId": nodeId,
"name": "viewBox", "text": "viewBox=\"0 0 120 120\"" }); | |
| 47 } | |
| 48 | |
| 49 function onAttributeModified(msg) { | |
| 50 var result = msg.params; | |
| 51 InspectorTest.log("Modified attribute:"); | |
| 52 InspectorTest.log(result.name + "=" + result.value); | |
| 53 InspectorTest.completeTest(); | |
| 54 } | |
| 55 | |
| 56 function dumpMainElementAttributes(next) | |
| 57 { | |
| 58 InspectorTest.sendCommand("DOM.getAttributes", { "nodeId": nodeId }, onA
ttributes); | |
| 59 | |
| 60 function onAttributes(msg) | |
| 61 { | |
| 62 if (!checkError(msg)) | |
| 63 return; | |
| 64 var array = msg.result.attributes; | |
| 65 for (var i = 0; i < array.length; i += 2) | |
| 66 InspectorTest.log(array[i] + "=" + array[i + 1]); | |
| 67 next(); | |
| 68 } | |
| 69 } | |
| 70 | |
| 71 function checkError(msg) | |
| 72 { | |
| 73 if (msg.error) { | |
| 74 InspectorTest.log(msg.error.message); | |
| 75 InspectorTest.completeTest(); | |
| 76 return false; | |
| 77 } | |
| 78 return true; | |
| 79 } | |
| 80 } | |
| 81 </script> | |
| 82 </head> | |
| 83 <body onload="runTest()"> | |
| 84 Test that DOM attribute case is preserved when modified in XML documents. | |
| 85 <svg id="main" xmlns="http://www.w3.org/2000/svg" width="600" height="500" viewB
ox="0 0 100 120" /> | |
| 86 </body> | |
| 87 </html> | |
| OLD | NEW |