tor-browser

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

load.image.html (2409B)


      1 <!DOCTYPE HTML>
      2 <html>
      3    <head>
      4        <title> W3C DOM Level 3 Event: load </title>
      5        <script type="text/javascript">
      6            var PassTest = function()
      7            {
      8                document.getElementById("testresult").firstChild.data = "PASS";
      9            }
     10 
     11            var FailTest = function()
     12            {
     13                document.getElementById("testresult").firstChild.data = "FAIL";
     14            }
     15 
     16            function TestCapture(evt)
     17            {
     18                if (evt.target.tagName == "IMG")
     19                {
     20                    TARGET = document.getElementById("target");
     21 
     22                    if ((evt.type == EVENT) && (evt.currentTarget == document) && (evt.target == TARGET))
     23                    {
     24                        TestResult = true;
     25                    }
     26                    else
     27                    {
     28                        TestResult = false;
     29                    }
     30                }
     31            }
     32 
     33            var EVENT = "load";
     34            var TARGET;
     35            var TestResult = false;
     36 
     37            try
     38            {
     39                document.addEventListener(EVENT, TestCapture, true);
     40            }
     41            catch(ex)
     42            {
     43                TestResult = false;
     44            }
     45 
     46            window.onload = function()
     47            {
     48                if (true == TestResult)
     49                {
     50                    PassTest();
     51                }
     52                else
     53                {
     54                    FailTest();
     55                }
     56            }
     57 
     58            function ReloadPage()
     59            {
     60                var LINK = document.getElementById("link");
     61                LINK.href = "load.image.html";
     62                LINK.appendChild(document.createTextNode("Image loading error. Click here to test again."));
     63            }
     64        </script>
     65    </head>
     66    <body>
     67        <h4>
     68            Test Description:
     69            load event fires when the DOM implementation finishes loading the resource (such as the document)
     70            and any dependent resources (such as images, style sheets, or scripts).
     71        </h4>
     72 
     73        <p><a id="link" href=""></a></p>
     74 
     75        <img id="target" src="./support/iepreview.png" width="300" height="300" onerror="ReloadPage()">
     76 
     77        <p>Test passes if the word "PASS" appears below after the above image is loaded.</p>
     78           <div>Test result: </div>
     79        <div id='testresult'>FAIL</div>
     80 
     81    </body>
     82 </html>