tor-browser

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

test_use_tree_cycle.html (1294B)


      1 <!doctype html>
      2 <title>Test for bug 1531333</title>
      3 <script src="/tests/SimpleTest/SimpleTest.js"></script>
      4 <link rel="stylesheet" href="/tests/SimpleTest/test.css">
      5 <style>
      6  symbol { display: block }
      7 </style>
      8 <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="10" height="10">
      9  <symbol id="svg-sprite" viewBox="0 0 133 230866">
     10    <title>svg-sprite</title>
     11    <symbol id="svg-sprite" viewBox="0 0 133 230866">
     12        <title>svg-sprite</title>
     13        <use xlink:href="#svg-sprite" width="500" height="500" />
     14    </symbol>
     15    <use xlink:href="#svg-sprite" y="1601" width="133" height="228958" />
     16  </symbol>
     17  <use xlink:href="#svg-sprite" y="1601" width="133" height="230866" />
     18 </svg>
     19 <script>
     20 function countUseElements(subtreeRoot) {
     21  if (!subtreeRoot)
     22    return 0;
     23 
     24  let i = 0;
     25  for (const use of subtreeRoot.querySelectorAll("use"))
     26    i += 1 + countUseElements(SpecialPowers.wrap(use).openOrClosedShadowRoot);
     27  return i;
     28 }
     29 SimpleTest.waitForExplicitFinish();
     30 onload = function() {
     31  document.body.offsetTop;
     32  // The three in the document, plus the two created from the element that's
     33  // not in the <symbol> subtree.
     34  is(countUseElements(document), 5, "Shouldn't create more than 5 use elements");
     35  SimpleTest.finish();
     36 }
     37 </script>