580.html (1273B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 5 <title>A div element with style="display:none" has aria-hidden="true", and then script sets style to "display: block".</title> 6 <script> 7 function replaceStyle (/* Element */ element, /* String */ selector, /* String */ newValue) { 8 element.setAttribute ('style', selector + ':' + newValue); 9 if (newValue == 'block') 10 element.setAttribute ('aria-hidden', 'false'); 11 else if (newValue == 'none') 12 element.setAttribute ('aria-hidden', 'true'); 13 } 14 </script> 15 </head> 16 <body> 17 <div id="test" aria-hidden="true" style="display:none;">This <div>'s style switched from 'display:none' to 'display:block'. It's <code>aria-hidden</code> was simultaneously switched to 'false'.</div> 18 <p> 19 <button onclick="replaceStyle (document.getElementById ('test'), 'display', 'block')" type="button">Change to 'display:block'</button> 20 <button onclick="replaceStyle (document.getElementById ('test'), 'display', 'none')" type="button">Change to 'display:none'</button> 21 <button onclick="window.location.reload()" type="button">Reload Page</button> 22 </p> 23 </body> 24 </html>