tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

util.js (646B)


      1 function eachDisplayContentsElementIn(document, window, callbackDo, callbackUndo) {
      2  var elements = [];
      3 
      4  document.body.offsetHeight;
      5 
      6  // NOTE: Doing qsa('*') and getComputedStyle is just for the
      7  // test's sake, since it's easier to mess it up when
      8  // getComputedStyle is involved.
      9  var all = document.querySelectorAll('*');
     10  for (var i = 0; i < all.length; ++i) {
     11    if (window.getComputedStyle(all[i]).display === "contents") {
     12      callbackDo(all[i]);
     13      elements.push(all[i]);
     14    }
     15  }
     16 
     17  document.body.offsetHeight;
     18 
     19  for (var i = 0; i < elements.length; ++i)
     20    callbackUndo(elements[i]);
     21 
     22  document.body.offsetHeight;
     23 }