| 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 logActiveElement() { | |
| 7 var el = document.activeElement; | |
| 8 log(el ? (el.id || el.tagName) : "(none)"); | |
| 9 } | |
| 10 | |
| 11 function test() | |
| 12 { | |
| 13 InspectorTest.sendCommand("Runtime.evaluate", { "expression": "logActiveElem
ent()" }); | |
| 14 | |
| 15 InspectorTest.sendCommand("DOM.getDocument", {}, onGotDocument); | |
| 16 | |
| 17 function onGotDocument(msg) { | |
| 18 if (msg.error) { | |
| 19 InspectorTest.log(msg.error.message); | |
| 20 InspectorTest.completeTest(); | |
| 21 return; | |
| 22 } | |
| 23 var node = msg.result.root; | |
| 24 InspectorTest.sendCommand("DOM.querySelector", { "nodeId": node.nodeId,
"selector": "#second" }, onQuerySelector); | |
| 25 } | |
| 26 | |
| 27 function onQuerySelector(msg) { | |
| 28 if (msg.error) { | |
| 29 InspectorTest.log(msg.error.message); | |
| 30 InspectorTest.completeTest(); | |
| 31 return; | |
| 32 } | |
| 33 var node = msg.result; | |
| 34 InspectorTest.sendCommand("DOM.focus", { "nodeId": node.nodeId }, onFocu
s); | |
| 35 } | |
| 36 | |
| 37 function onFocus(msg) { | |
| 38 if (msg.error) | |
| 39 InspectorTest.log(msg.error); | |
| 40 | |
| 41 InspectorTest.sendCommand("Runtime.evaluate", { expression: 'logActiveEl
ement()' }); | |
| 42 InspectorTest.completeTest(); | |
| 43 } | |
| 44 } | |
| 45 | |
| 46 </script> | |
| 47 </head> | |
| 48 <body onload="runTest()"> | |
| 49 <input></input> | |
| 50 <input id="second"></input> | |
| 51 </body> | |
| 52 </html> | |
| OLD | NEW |