disabled-003.html (1190B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <title>Disable nested fieldsets with focused element</title> 4 <link rel="help" href="https://html.spec.whatwg.org/multipage/#the-fieldset-element"> 5 <link rel="help" href="https://bugs.chromium.org/p/chromium/issues/detail?id=1427047"> 6 <link rel="author" href="mailto:xiaochengh@chromium.org"> 7 <script src="/resources/testharness.js"></script> 8 <script src="/resources/testharnessreport.js"></script> 9 10 <div id=container1> 11 <fieldset id=target1> 12 <legend>foo</legend> 13 <fieldset> 14 <legend>bar</legend> 15 <input id=input1> 16 </fieldset> 17 </fieldset> 18 </div> 19 <script> 20 test(() => { 21 input1.focus(); 22 target1.disabled = true; 23 assert_not_equals(document.activeElement, input1); 24 }, 'Disable light-nested fieldsets should not crash'); 25 </script> 26 27 <div id=container2></div> 28 <script> 29 test(() => { 30 let n = 100; 31 let markup = '<fieldset><legend>foo</legend>'.repeat(n) + 32 '<input id=input2>' + '</fieldset>'.repeat(n); 33 container2.innerHTML = markup; 34 input2.focus(); 35 container2.firstChild.disabled = true; 36 assert_not_equals(document.activeElement, input2); 37 }, 'Disable deep-nested fieldsets should not hang'); 38 </script>