1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47

content / test / data / accessibility / css / head-style-script-content-visibility-hidden.html [blame]

<!--
@BLINK-ALLOW:htmlTag*
@WAIT-FOR:Done
-->
<!-- Do not create accessible objects for head, style, script subtrees
  when hidden via CSS content-visibility -->
<html>
  <head>
    <title>Loading...</title>
    <style>
      head,style,script { display:block; content-visibility:hidden; }
    </style>
    <style>
      p { outline: 2px solid green; }
    </style>
    <script>
      document.addEventListener('DOMContentLoaded', () => {
        setTimeout(() => {
          // Change inner text of head, style, and script  to see if it causes
          // an attempt to create an accessible object inside a subtree of head,
          // style, or script, which is not allowed. A DCHECK will be triggered
          // if an accessible object is created within any of these elements.
          // Leaves the first two style and script elements alone as they are
          // used for the test implementation.
          document.querySelectorAll('style')[1].innerText = 'p { outline: 3px dotted blue; }';
          document.querySelectorAll('style')[2].innerText = 'p { outline: 3px dotted blue; }';
          document.querySelectorAll('script')[1].innerText = 'var y = 5;';
          document.querySelectorAll('script')[2].innerText = 'var y = 5;';
          document.head.appendChild(document.createElement('meta'));
          document.head.appendChild(document.createElement('p'));
          document.title = 'Done';
        }, 50);
      });
    </script>
    <script>
      var x = 3;
    </script>
  </head>
</html>
<body>
  <style>
    p { outline: 2px solid green; }
  </style>
  <script>
    var x = 3;
  </script>
</body>