tor-browser

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

object-attributes.html (2387B)


      1 <!DOCTYPE html>
      2 <meta charset="utf-8">
      3 <title>HTML Test: object - attributes</title>
      4 <link rel="author" title="Intel" href="http://www.intel.com">
      5 <script src="/resources/testharness.js"></script>
      6 <script src="/resources/testharnessreport.js"></script>
      7 <body onload="on_load()">
      8 <div id="log"></div>
      9 <form>
     10  <object id="obj1" data="/common/blank.html" name="o" height="50" width="100"></object>
     11  <object id="obj2" name="p" type="image/png"></object>
     12  <object id="obj3" data="missing.html" name="o3" height="50" width="100"></object>
     13 </form>
     14 <script>
     15  var obj1;
     16  var obj2;
     17  var obj3;
     18  var t1 = async_test("object.contentWindow");
     19  var t2 = async_test("object.contentWindow.name");
     20  var t3 = async_test("object.width");
     21  var t4 = async_test("object.height");
     22 
     23  setup(function() {
     24    obj1 = document.getElementById("obj1");
     25    obj2 = document.getElementById("obj2");
     26    obj3 = document.getElementById("obj3");
     27  });
     28 
     29  function on_load () {
     30    t1.step(function() {
     31      assert_not_equals(obj1.contentWindow, null, "The contentWindow of the object element should not be null.");
     32      assert_equals(obj2.contentWindow, null, "The contentWindow of the object element should be null when it type attribute starts with 'image/'.");
     33      assert_equals(obj3.contentWindow, null, "The contentWindow of the object element should be null as it is showing fallback content.");
     34    });
     35    t1.done()
     36 
     37    t2.step(function() {
     38      assert_equals(obj1.contentWindow.name, "o", "The contentWindow's name of the object element should be 'o'.");
     39      obj1.setAttribute("name", "o1");
     40      assert_equals(obj1.name, "o1", "The name of the object element should be 'o1'.");
     41      assert_equals(obj1.contentWindow.name, "o", "The contentWindow's name of the object element should still be 'o'.");
     42      obj1.removeAttribute("name");
     43      assert_equals(obj1.name, "", "The name of the object element should be empty string.");
     44      assert_equals(obj1.contentWindow.name, "o", "The contentWindow's name of the object element should still be 'o'.");
     45    });
     46    t2.done()
     47 
     48    t3.step(function() {
     49      assert_equals(getComputedStyle(obj1, null)["width"], "100px", "The width should be 100px.");
     50    });
     51    t3.done();
     52 
     53    t4.step(function() {
     54      assert_equals(getComputedStyle(obj1, null)["height"], "50px", "The height should be 50px.");
     55    });
     56    t4.done();
     57  }
     58 </script>
     59 
     60 </body>