tor-browser

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

test_inspector-template.html (1905B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <!--
      4 https://bugzilla.mozilla.org/show_bug.cgi?id=1078374
      5 Display template tag content in inspector.
      6 -->
      7 <head>
      8  <meta charset="utf-8">
      9  <title>Test for Bug </title>
     10 
     11  <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
     12  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
     13  <script type="application/javascript" src="inspector-helpers.js"></script>
     14  <script type="application/javascript">
     15 "use strict";
     16 
     17 window.onload = function() {
     18  SimpleTest.waitForExplicitFinish();
     19 
     20  let gWalker = null;
     21 
     22  addAsyncTest(async function setup() {
     23    const url = document.getElementById("inspectorContent").href;
     24 
     25    const { target } = await attachURL(url);
     26    const inspector = await target.getFront("inspector");
     27    gWalker = inspector.walker;
     28 
     29    runNextTest();
     30  });
     31 
     32  addAsyncTest(async function testWalker() {
     33    const nodeFront = await gWalker.querySelector(gWalker.rootNode, "template");
     34 
     35    let children = await gWalker.children(nodeFront);
     36    is(children.nodes.length, 1, "Found one child under the template element");
     37 
     38    const docFragment = children.nodes[0];
     39    is(docFragment.nodeName, "#document-fragment",
     40      "First child under <template> is a document-fragment");
     41 
     42    children = await gWalker.children(docFragment);
     43    is(children.nodes.length, 1, "Found one child under the template element");
     44 
     45    const p = children.nodes[0];
     46    is(p.nodeName, "P",
     47      "First child under the document-fragment is a p element");
     48 
     49    runNextTest();
     50  });
     51 
     52  runNextTest();
     53 };
     54  </script>
     55 </head>
     56 <body>
     57 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=">Mozilla Bug </a>
     58 <a id="inspectorContent" target="_blank" href="inspector-template.html">Test Document</a>
     59 <p id="display"></p>
     60 <div id="content" style="display: none">
     61 
     62 </div>
     63 <pre id="test">
     64 </pre>
     65 </body>
     66 </html>