Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / inspector-protocol / dom / dom-focus.html
blob55fb3800c77e7b7ae41ec318336472f7b7bea499
1 <html>
2 <head>
3 <script type="text/javascript" src="../../http/tests/inspector-protocol/inspector-protocol-test.js"></script>
4 <script>
6 function logActiveElement() {
7 var el = document.activeElement;
8 log(el ? (el.id || el.tagName) : "(none)");
11 function test()
13 InspectorTest.sendCommand("Runtime.evaluate", { "expression": "logActiveElement()" });
15 InspectorTest.sendCommand("DOM.getDocument", {}, onGotDocument);
17 function onGotDocument(msg) {
18 if (msg.error) {
19 InspectorTest.log(msg.error.message);
20 InspectorTest.completeTest();
21 return;
23 var node = msg.result.root;
24 InspectorTest.sendCommand("DOM.querySelector", { "nodeId": node.nodeId, "selector": "#second" }, onQuerySelector);
27 function onQuerySelector(msg) {
28 if (msg.error) {
29 InspectorTest.log(msg.error.message);
30 InspectorTest.completeTest();
31 return;
33 var node = msg.result;
34 InspectorTest.sendCommand("DOM.focus", { "nodeId": node.nodeId }, onFocus);
37 function onFocus(msg) {
38 if (msg.error)
39 InspectorTest.log(msg.error);
41 InspectorTest.sendCommand("Runtime.evaluate", { expression: 'logActiveElement()' });
42 InspectorTest.completeTest();
46 </script>
47 </head>
48 <body onload="runTest()">
49 <input></input>
50 <input id="second"></input>
51 </body>
52 </html>