tor-browser

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

load-text-plain.html (1736B)


      1 <!DOCTYPE html>
      2 <title>Page load processing model for text files</title>
      3 <link rel="author" title="Ms2ger" href="ms2ger@gmail.com">
      4 <link rel="help" href="https://html.spec.whatwg.org/multipage/#read-text">
      5 <script src="/resources/testharness.js"></script>
      6 <script src="/resources/testharnessreport.js"></script>
      7 <div id="log"></div>
      8 <script>
      9 var t = async_test("Checking document metadata for text file");
     10 var tD = async_test("Checking DOM for text file");
     11 var tC = async_test("Checking contents for text file");
     12 var iframe = document.body.appendChild(document.createElement("iframe"));
     13 iframe.onload = function(e) {
     14  var doc = iframe.contentDocument;
     15  t.step(function() {
     16    assert_equals(doc.compatMode, "CSS1Compat");
     17    assert_equals(doc.contentType, "text/plain");
     18    assert_equals(doc.doctype, null);
     19    t.done();
     20  })
     21  tD.step(function() {
     22    assert_equals(doc.childNodes.length, 1, "Document should have 1 child")
     23    assert_equals(doc.documentElement.tagName, "HTML");
     24    assert_equals(doc.documentElement.childNodes.length, 2,
     25                  "Root element should have 2 children")
     26    assert_equals(doc.documentElement.firstChild.tagName, "HEAD");
     27    assert_equals(doc.documentElement.lastChild.tagName, "BODY");
     28    assert_equals(doc.documentElement.lastChild.childNodes.length, 1,
     29                  "Body element should have 1 child")
     30    assert_equals(doc.documentElement.lastChild.firstChild.tagName, "PRE");
     31    tD.done();
     32  })
     33  tC.step(function() {
     34    assert_equals(doc.documentElement.lastChild.firstChild.firstChild.data,
     35                  "This is a sample text/plain document.\n\nThis is not an HTML document.\n\n");
     36    tC.done();
     37  })
     38 };
     39 iframe.src = "../../../../common/text-plain.txt";
     40 </script>