mouse-click-change-summary-to-display-none.html (883B)
1 <!DOCTYPE html> 2 <!-- Any copyright is dedicated to the Public Domain. 3 - http://creativecommons.org/publicdomain/zero/1.0/ --> 4 5 <html class="reftest-wait"> 6 <script> 7 function runTest() { 8 // Both Chrome and Safari add the 'open' attribute to the details element. 9 // Firefox has the same behavior. 10 var details = document.getElementById("details"); 11 var summary = document.getElementById("summary"); 12 13 document.body.addEventListener("click", function () { 14 // Change summary to display: none in capturing phase. 15 summary.style.display = "none"; 16 }, true); 17 18 summary.dispatchEvent(new MouseEvent("click")); 19 20 document.documentElement.removeAttribute("class"); 21 } 22 </script> 23 <body onload="runTest();"> 24 <details id="details"> 25 <summary id="summary">Summary</summary> 26 <p>This is the details.</p> 27 </details> 28 </body> 29 </html>