dynamic-add-details.html (855B)
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 // Append open <details> into <body> 9 var summary = document.createElement("summary"); 10 var summary_text = document.createTextNode("Summary"); 11 summary.appendChild(summary_text); 12 13 var paragraph = document.createElement("p"); 14 var details_text = document.createTextNode("This is the details."); 15 paragraph.appendChild(details_text); 16 17 var details = document.createElement("details"); 18 details.appendChild(summary); 19 details.appendChild(paragraph); 20 details.open = true; 21 22 document.body.appendChild(details); 23 document.documentElement.removeAttribute("class"); 24 } 25 </script> 26 <body onload="runTest();"> 27 </body> 28 </html>