Truly independent web browser
Tests/LibWeb: Import WPT tests for dialog and autofocus delegates
Andreas Kling109f3065476e
diff --git a/Tests/LibWeb/Text/expected/wpt-import/html/semantics/interactive-elements/the-dialog-element/dialog-autofocus-multiple-times.txt b/Tests/LibWeb/Text/expected/wpt-import/html/semantics/interactive-elements/the-dialog-element/dialog-autofocus-multiple-times.txtnew file mode 100644index 00000000000..4533a73a119--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/html/semantics/interactive-elements/the-dialog-element/dialog-autofocus-multiple-times.txt@@ -0,0 +1,6 @@+Harness status: OK++Found 1 tests++1 Fail+Fail autofocus is run every time a dialog is opened\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/html/semantics/interactive-elements/the-dialog-element/dialog-autofocus.txt b/Tests/LibWeb/Text/expected/wpt-import/html/semantics/interactive-elements/the-dialog-element/dialog-autofocus.txtnew file mode 100644index 00000000000..1614562071e--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/html/semantics/interactive-elements/the-dialog-element/dialog-autofocus.txt@@ -0,0 +1,6 @@+Harness status: OK++Found 1 tests++1 Fail+Fail autofocus when a modal dialog is opened\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/html/semantics/interactive-elements/the-dialog-element/dialog-focus-shadow-double-nested.txt b/Tests/LibWeb/Text/expected/wpt-import/html/semantics/interactive-elements/the-dialog-element/dialog-focus-shadow-double-nested.txtnew file mode 100644index 00000000000..344698ac0f8--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/html/semantics/interactive-elements/the-dialog-element/dialog-focus-shadow-double-nested.txt@@ -0,0 +1,7 @@+Harness status: OK++Found 2 tests++2 Fail+Fail show()+Fail showModal()\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/html/semantics/interactive-elements/the-dialog-element/show-modal-focusing-steps.txt b/Tests/LibWeb/Text/expected/wpt-import/html/semantics/interactive-elements/the-dialog-element/show-modal-focusing-steps.txtnew file mode 100644index 00000000000..89d23b3b323--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/html/semantics/interactive-elements/the-dialog-element/show-modal-focusing-steps.txt@@ -0,0 +1,6 @@+Harness status: OK++Found 1 tests++1 Fail+Fail focus when a modal dialog is opened\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus/focus-autofocus.txt b/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus/focus-autofocus.txtnew file mode 100644index 00000000000..756d07c38f0--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/shadow-dom/focus/focus-autofocus.txt@@ -0,0 +1,11 @@+Harness status: OK++Found 5 tests++2 Pass+3 Fail+Fail The second input should be focused since it has autofocus+Pass Focus should not be delegated to the autofocus element because the inner host doesn't have delegates focus+Fail Focus should be delegated to the autofocus element when the inner host has delegates focus+Pass Focus should not be delegated to the slotted elements+Fail Focus should be delegated to the nested div which has autofocus based on the tree order\ No newline at end of filediff --git a/Tests/LibWeb/Text/input/wpt-import/html/semantics/interactive-elements/the-dialog-element/dialog-autofocus-multiple-times.html b/Tests/LibWeb/Text/input/wpt-import/html/semantics/interactive-elements/the-dialog-element/dialog-autofocus-multiple-times.htmlnew file mode 100644index 00000000000..6653c306db7--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/html/semantics/interactive-elements/the-dialog-element/dialog-autofocus-multiple-times.html@@ -0,0 +1,44 @@+<!DOCTYPE html>+<html>+<head>+<script src="../../../../resources/testdriver.js"></script>+<script src="../../../../resources/testdriver-vendor.js"></script>+<script src="../../../../resources/testharness.js"></script>+<script src="../../../../resources/testharnessreport.js"></script>+<script src="./resources/common.js"></script>+<script>+promise_test(() => {+ return waitUntilLoadedAndAutofocused().then(() => {+ assert_equals(document.activeElement, document.getElementById("outer-button"));++ var focusCount = 0;+ var dlg = document.getElementById("dlg");+ var input1 = document.getElementById("input1");+ var input2 = document.getElementById("input2");+ input2.onfocus = function() { focusCount += 1 };++ var expectedFocusCount = 3;+ for (i = 0; i < expectedFocusCount; i++) {+ dlg.show();+ assert_equals(document.activeElement, input2);+ input1.focus();+ assert_equals(document.activeElement,input1);+ dlg.close();+ }++ assert_equals(focusCount.toString(), expectedFocusCount.toString());+ });+}, "autofocus is run every time a dialog is opened");+</script>+</head>+<body>+<button id="outer-button" autofocus></button>+<dialog id="dlg">+ <!-- Unfocusable elements with [autofocus] should be ignored. -->+ <input autofocus disabled>+ <textarea autofocus hidden></textarea>+ <input id="input1">+ <input id="input2" autofocus>+</dialog>+</body>+</html>diff --git a/Tests/LibWeb/Text/input/wpt-import/html/semantics/interactive-elements/the-dialog-element/dialog-autofocus.html b/Tests/LibWeb/Text/input/wpt-import/html/semantics/interactive-elements/the-dialog-element/dialog-autofocus.htmlnew file mode 100644index 00000000000..5ee41da2343--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/html/semantics/interactive-elements/the-dialog-element/dialog-autofocus.html@@ -0,0 +1,67 @@+<!DOCTYPE html>+<html>+<head>+<script src="../../../../resources/testdriver.js"></script>+<script src="../../../../resources/testdriver-vendor.js"></script>+<script src="../../../../resources/testharness.js"></script>+<script src="../../../../resources/testharnessreport.js"></script>+<script src="./resources/common.js"></script>+<script>+promise_test(() => {+ return waitUntilLoadedAndAutofocused().then(() => {+ assert_equals(document.activeElement, document.getElementById("outer-button"));++ var dialog = document.getElementById('dialog');+ dialog.showModal();++ autofocusButton = document.getElementById('autofocus-button');+ assert_equals(document.activeElement, autofocusButton);++ anotherButton = document.getElementById('another-button');+ anotherButton.focus();+ assert_equals(document.activeElement, anotherButton);++ // Test that recreating layout does not give focus back to a previously autofocused element.+ autofocusButton.style.display = 'none';+ document.body.offsetHeight;+ autofocusButton.style.display = 'block';+ document.body.offsetHeight;+ assert_equals(document.activeElement, anotherButton);++ // Test that reinserting does not give focus back to a previously autofocused element.+ var parentNode = autofocusButton.parentNode;+ parentNode.removeChild(autofocusButton);+ document.body.offsetHeight;+ parentNode.appendChild(autofocusButton);+ document.body.offsetHeight;+ assert_equals(document.activeElement, anotherButton);++ dialog.close();+ // Test that dialog focusing steps run when a dialog is reopened.+ dialog.showModal();+ assert_equals(document.activeElement, autofocusButton);+ dialog.close();+ });+}, "autofocus when a modal dialog is opened");+</script>+</head>+<body>+<button id="outer-button" autofocus></button>+<dialog id="dialog">+ <button></button>+ <!-- Unfocusable elements with [autofocus] should be ignored. -->+ <input autofocus disabled>+ <textarea autofocus hidden></textarea>+ <dialog>+ <button autofocus></button>+ </dialog>+ <div>+ <span>+ <button id="autofocus-button" autofocus></button>+ </span>+ </div>+ <button id="another-button" autofocus></button>+</dialog>++</body>+</html>diff --git a/Tests/LibWeb/Text/input/wpt-import/html/semantics/interactive-elements/the-dialog-element/dialog-focus-shadow-double-nested.html b/Tests/LibWeb/Text/input/wpt-import/html/semantics/interactive-elements/the-dialog-element/dialog-focus-shadow-double-nested.htmlnew file mode 100644index 00000000000..368a720d1e4--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/html/semantics/interactive-elements/the-dialog-element/dialog-focus-shadow-double-nested.html@@ -0,0 +1,53 @@+<!DOCTYPE html>+<meta charset="utf-8">+<title>dialog focusing delegation: with two nested shadow trees</title>+<script src="../../../../resources/testharness.js"></script>+<script src="../../../../resources/testharnessreport.js"></script>+<body>++<dialog>+ <template class="turn-into-shadow-tree delegates-focus">+ <button disabled>Non-focusable</button>+ <template class="turn-into-shadow-tree delegates-focus">+ <button tabindex="-1">Focusable</button>+ <button tabindex="-1" autofocus>Focusable</button>+ <button tabindex="-1">Focusable</button>+ </template>+ <button tabindex="-1">Focusable</button>+ </template>+ <button tabindex="-1">Focusable</button>+</dialog>++<script>+function turnIntoShadowTree(template) {+ for (const subTemplate of template.content.querySelectorAll(".turn-into-shadow-tree")) {+ turnIntoShadowTree(subTemplate);+ }++ const div = document.createElement("div");+ div.attachShadow({ mode: "open", delegatesFocus: template.classList.contains("delegates-focus") });+ div.shadowRoot.append(template.content);+ template.replaceWith(div);+}++for (const template of document.querySelectorAll(".turn-into-shadow-tree")) {+ turnIntoShadowTree(template);+}++for (const method of ["show", "showModal"]) {+ test(t => {+ const dialog = document.querySelector("dialog");+ dialog[method]();+ t.add_cleanup(() => dialog.close());++ const shadowHostOuter = dialog.querySelector("div");+ assert_equals(document.activeElement, shadowHostOuter, "document.activeElement");++ const shadowHostInner = shadowHostOuter.shadowRoot.querySelector("div");+ assert_equals(shadowHostOuter.shadowRoot.activeElement, shadowHostInner, "shadowHostOuter.shadowRoot.activeElement");++ const button = shadowHostInner.shadowRoot.querySelector("[autofocus]");+ assert_equals(shadowHostInner.shadowRoot.activeElement, button, "shadowHostInner.shadowRoot.activeElement");+ }, `${method}()`);+}+</script>diff --git a/Tests/LibWeb/Text/input/wpt-import/html/semantics/interactive-elements/the-dialog-element/resources/common.js b/Tests/LibWeb/Text/input/wpt-import/html/semantics/interactive-elements/the-dialog-element/resources/common.jsnew file mode 100644index 00000000000..0ce024bfd2f--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/html/semantics/interactive-elements/the-dialog-element/resources/common.js@@ -0,0 +1,19 @@+function waitUntilLoadedAndAutofocused() {+ return new Promise(function(resolve) {+ var loaded = false;+ var autofocused = false;+ window.addEventListener('load', function() {+ loaded = true;+ if (autofocused)+ resolve();+ }, false);+ document.addEventListener('focusin', function() {+ if (autofocused)+ return;+ autofocused = true;+ if (loaded)+ resolve();+ }, false);+ test_driver.click(document.documentElement);+ });+}diff --git a/Tests/LibWeb/Text/input/wpt-import/html/semantics/interactive-elements/the-dialog-element/show-modal-focusing-steps.html b/Tests/LibWeb/Text/input/wpt-import/html/semantics/interactive-elements/the-dialog-element/show-modal-focusing-steps.htmlnew file mode 100644index 00000000000..1ab3d5929e7--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/html/semantics/interactive-elements/the-dialog-element/show-modal-focusing-steps.html@@ -0,0 +1,65 @@+<!DOCTYPE html>+<html>+<head>+<script src="../../../../resources/testdriver.js"></script>+<script src="../../../../resources/testdriver-vendor.js"></script>+<script src="../../../../resources/testharness.js"></script>+<script src="../../../../resources/testharnessreport.js"></script>+<script src="./resources/common.js"></script>+<script>+promise_test(() => {+ return waitUntilLoadedAndAutofocused().then(() => {+ outerButton = document.getElementById('outer-button');+ assert_equals(document.activeElement, outerButton);++ // Test that focus goes to the dialog if the dialog has no focusable elements+ var outerDialog = document.getElementById('outer-dialog');+ outerDialog.showModal();+ assert_equals(document.activeElement, outerDialog);++ // Test that an autofocus element in the dialog gets focus.+ var dialog = document.getElementById('dialog');+ dialog.showModal();+ autofocusButton = document.getElementById('autofocus-button');+ assert_equals(document.activeElement, autofocusButton);+ dialog.close();++ // ... or else first focusable element in the dialog gets focus.+ autofocusButton.parentNode.removeChild(autofocusButton);+ dialog.showModal();+ firstButton = document.getElementById('first-button');+ assert_equals(document.activeElement, firstButton);+ dialog.close();++ // ... or else the dialog itself gets focus.;+ var buttons = dialog.querySelectorAll('button');+ for (var i = 0; i < buttons.length; ++i)+ buttons[i].hidden = true;+ dialog.showModal();+ assert_equals(document.activeElement, dialog);+ dialog.close();++ document.getElementById('outer-dialog').close();+ });+}, "focus when a modal dialog is opened");+</script>+</head>+<body>+<button id="outer-button" autofocus></button>+<dialog id="outer-dialog">+ <dialog id="dialog" tabindex=0>+ <button disabled></button>+ <dialog>+ <button autofocus></button>+ </dialog>+ <button id="first-button"></button>+ <div>+ <span>+ <button id="autofocus-button" autofocus></button>+ </span>+ </div>+ <button id="final-button"></button>+ </dialog>+</dialog>+</body>+</html>diff --git a/Tests/LibWeb/Text/input/wpt-import/shadow-dom/focus/focus-autofocus.html b/Tests/LibWeb/Text/input/wpt-import/shadow-dom/focus/focus-autofocus.htmlnew file mode 100644index 00000000000..f033c3013a5--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/shadow-dom/focus/focus-autofocus.html@@ -0,0 +1,338 @@+<!DOCTYPE html>+<html>+<head>+<meta name="author" title="Sean Feng" href="mailto:[email protected]">+<meta name="assert" content="Elements with autofocus should have high precedence over other elements for delegates focus">+<link rel="help" href="https://github.com/whatwg/html/pull/6990">+<script src="../../resources/testharness.js"></script>+<script src="../../resources/testharnessreport.js"></script>+<script src="../../resources/testdriver.js"></script>+<script src="../../resources/testdriver-vendor.js"></script>+<script src="resources/shadow-utils.js"></script>+</head>++<body>+ <script>+ function createShadowDOMTree() {+ // <div #host> (delegatesFocus = true)+ // #shadowRoot+ // <div #firstOuterDiv>+ // <div #innertHost>+ // #shadowRoot+ // <div #firstInnerDiv>+ // <div #secondInnerDiv>+ // <div #secondOuterDiv>+ const host = document.createElement("div");+ host.setAttribute("id", "host");+ const outerRoot = host.attachShadow({mode: "open", delegatesFocus: true});++ const firstOuterDiv = document.createElement("div");++ const innerHost = document.createElement("div");+ const innerRoot = innerHost.attachShadow({mode: "open"});+ const firstInnerDiv = document.createElement("div");+ const secondInnerDiv = document.createElement("div");+ innerRoot.appendChild(firstInnerDiv);+ innerRoot.appendChild(secondInnerDiv);++ const secondOuterDiv = document.createElement("div");++ outerRoot.appendChild(firstOuterDiv);+ outerRoot.appendChild(innerHost);+ outerRoot.appendChild(secondOuterDiv);+ document.body.appendChild(host);+ return [+ host,+ outerRoot,+ firstOuterDiv,+ secondOuterDiv,+ innerHost,+ innerRoot,+ firstInnerDiv,+ secondInnerDiv+ ]+ }++ function resetShadowDOMTree() {+ const host = document.getElementById("host");+ if (host) {+ host.remove();+ }+ return createShadowDOMTree();+ }++ function resetTabIndexAndFocus(+ firstOuterDiv,+ secondOuterDiv,+ firstInnerDiv,+ secondInnerDiv,+ outerRoot,+ innerRoot+ ) {+ firstOuterDiv.removeAttribute("tabindex");+ firstOuterDiv.removeAttribute("autofocus");++ secondOuterDiv.removeAttribute("tabindex");+ secondOuterDiv.removeAttribute("autofocus");++ firstInnerDiv.removeAttribute("tabindex");+ firstInnerDiv.removeAttribute("autofocus");++ secondInnerDiv.removeAttribute("tabindex");+ secondInnerDiv.removeAttribute("autofocus");++ resetFocus(document);+ resetFocus(outerRoot);+ resetFocus(innerRoot);+ }++ function setAllTabIndexTo(+ firstOuterDiv,+ secondOuterDiv,+ firstInnerDiv,+ secondInnerDiv,+ tabIndex+ ) {+ firstOuterDiv.tabIndex = tabIndex;+ secondOuterDiv.tabIndex = tabIndex;+ firstInnerDiv.tabIndex = tabIndex;+ secondInnerDiv.tabIndex = tabIndex;+ }++ test(function() {+ const [+ host,+ outerRoot,+ firstOuterDiv,+ secondOuterDiv,+ innerHost,+ innerRoot,+ firstInnerDiv,+ secondInnerDiv+ ] = resetShadowDOMTree();++ resetTabIndexAndFocus(+ firstOuterDiv,+ secondOuterDiv,+ firstInnerDiv,+ secondInnerDiv,+ outerRoot,+ innerRoot+ );++ setAllTabIndexTo(+ firstOuterDiv,+ secondOuterDiv,+ firstInnerDiv,+ secondInnerDiv,+ 0+ );++ // <div #host> (delegatesFocus = true)+ // #shadowRoot+ // <div tabIndex=0 #firstOuterDiv>+ // <div #innertHost>+ // #shadowRoot+ // <div tabIndex=0 #firstInnerDiv>+ // <div tabIndex=0 #secondInnerDiv>+ // <div tabIndex=0 autofocus #secondOuterDiv>+ secondOuterDiv.autofocus = true;+ secondOuterDiv.setAttribute("autofocus", true);++ host.focus();++ assert_equals(document.activeElement, host);+ assert_equals(outerRoot.activeElement, secondOuterDiv);+ }, "The second input should be focused since it has autofocus");++ test(function() {+ const [+ host,+ outerRoot,+ firstOuterDiv,+ secondOuterDiv,+ innerHost,+ innerRoot,+ firstInnerDiv,+ secondInnerDiv+ ] = resetShadowDOMTree();++ resetTabIndexAndFocus(+ firstOuterDiv,+ secondOuterDiv,+ firstInnerDiv,+ secondInnerDiv,+ outerRoot,+ innerRoot+ );++ // <div #host> (delegatesFocus = true)+ // #shadowRoot+ // <div #firstOuterDiv>+ // <div #innertHost>+ // #shadowRoot+ // <div tabIndex=0 #firstInnerDiv>+ // <div tabIndex=0 autofocus #secondInnerDiv>+ // <div #secondOuterDiv>+ firstInnerDiv.tabIndex = 0;+ secondInnerDiv.tabIndex = 0;+ secondInnerDiv.setAttribute("autofocus", true);++ host.focus();+ assert_equals(document.activeElement, document.body);+ assert_equals(outerRoot.activeElement, null);+ }, "Focus should not be delegated to the autofocus element because the inner host doesn't have delegates focus");++ test(function() {+ const [+ host,+ outerRoot,+ firstOuterDiv,+ secondOuterDiv,+ innerHost,+ innerRoot,+ firstInnerDiv,+ secondInnerDiv+ ] = resetShadowDOMTree();++ resetTabIndexAndFocus(+ firstOuterDiv,+ secondOuterDiv,+ firstInnerDiv,+ secondInnerDiv,+ outerRoot,+ innerRoot+ );++ const newInnerHost = document.createElement("div");+ const newInnerRoot = newInnerHost.attachShadow({mode: "open", delegatesFocus: true});+ const newFirstInnerDiv = document.createElement("div");+ const newSecondInnerDiv = document.createElement("div");+ newFirstInnerDiv.setAttribute("tabIndex", 0);+ newSecondInnerDiv.setAttribute("tabIndex", 0);++ newSecondInnerDiv.setAttribute("autofocus", true);+ newInnerRoot.appendChild(newFirstInnerDiv);+ newInnerRoot.appendChild(newSecondInnerDiv);++ // <div #host> (delegatesFocus = true)+ // #shadowRoot+ // <div #firstOuterDiv>+ // <div #innertHost> (delegatesFocus = true)+ // #shadowRoot+ // <div tabIndex=0 #newFirstInnerDiv>+ // <div tabIndex=0 autofocus #newSecondInnerDiv>+ // <div #secondOuterDiv>+ outerRoot.replaceChild(newInnerHost, innerHost);++ host.focus();++ assert_equals(document.activeElement, host);+ assert_equals(outerRoot.activeElement, newInnerHost);+ assert_equals(newInnerRoot.activeElement, newSecondInnerDiv);+ }, "Focus should be delegated to the autofocus element when the inner host has delegates focus");++ test(function() {+ const [+ host,+ outerRoot,+ firstOuterDiv,+ secondOuterDiv,+ innerHost,+ innerRoot,+ firstInnerDiv,+ secondInnerDiv+ ] = resetShadowDOMTree();++ resetTabIndexAndFocus(+ firstOuterDiv,+ secondOuterDiv,+ firstInnerDiv,+ secondInnerDiv,+ outerRoot,+ innerRoot+ );++ // <div #host> (delegatesFocus = true)+ // #shadowRoot+ // <slot>+ // (slotted) <div autofocus tabIndex=0 #slottedAutofocus></div>+ // <div tabIndex=0 #firstOuterDiv>+ // <div #innertHost>+ // #shadowRoot+ // <div tabIndex=0 #firstInnerDiv>+ // <div tabIndex=0 autofocus #secondInnerDiv>+ // <div #secondOuterDiv>++ const slottedAutofocus = document.createElement("div");+ slottedAutofocus.tabIndex = 0;+ slottedAutofocus.setAttribute("autofocus", true);+ host.appendChild(slottedAutofocus);++ const slot = document.createElement("slot");+ outerRoot.insertBefore(slot, firstOuterDiv);++ firstOuterDiv.tabIndex = 0;++ host.focus();+ assert_equals(document.activeElement, host);+ assert_equals(outerRoot.activeElement, firstOuterDiv);+ }, "Focus should not be delegated to the slotted elements");++ test(function() {+ const [+ host,+ outerRoot,+ firstOuterDiv,+ secondOuterDiv,+ innerHost,+ innerRoot,+ firstInnerDiv,+ secondInnerDiv+ ] = resetShadowDOMTree();++ resetTabIndexAndFocus(+ firstOuterDiv,+ secondOuterDiv,+ firstInnerDiv,+ secondInnerDiv,+ outerRoot,+ innerRoot+ );++ // <div #host> (delegatesFocus = true)+ // #shadowRoot+ // <div #firstOuterDiv>+ // <div tabIndex=0 #firstNestedDiv>+ // <div tabIndex=0 #secondNestedDiv>+ // <div tabIndex=0 autofocus #thirdNestedDiv>+ // <div #innertHost>+ // #shadowRoot+ // <div #firstInnerDiv>+ // <div #secondInnerDiv>+ // <div autofocus tabIndex=0 #secondOuterDiv>++ secondInnerDiv.tabIndex = 0;+ secondInnerDiv.setAttribute("autofocus", true);++ const firstNestedDiv = document.createElement("div");+ const secondNestedDiv = document.createElement("div");+ const thirdNestedDiv = document.createElement("div");++ firstNestedDiv.tabIndex = 0;+ secondNestedDiv.tabIndex = 0;+ thirdNestedDiv.tabIndex = 0;+ thirdNestedDiv.setAttribute("autofocus", true);++ firstOuterDiv.appendChild(firstNestedDiv);+ firstNestedDiv.appendChild(secondNestedDiv);+ secondNestedDiv.appendChild(thirdNestedDiv);++ host.focus();++ assert_equals(document.activeElement, host);+ assert_equals(outerRoot.activeElement, thirdNestedDiv);+ }, "Focus should be delegated to the nested div which has autofocus based on the tree order");+ </script>+</body>+</html>