| OLD | NEW |
| 1 <!DOCTYPE HTML> | 1 <!DOCTYPE HTML> |
| 2 <title>DOM Image constructor Test</title> | 2 <title>DOM Image constructor Test</title> |
| 3 <meta content="text/html; charset=UTF-8" http-equiv="Content-Type"> | 3 <meta content="text/html; charset=UTF-8" http-equiv="Content-Type"> |
| 4 <link rel="help" href="https://html.spec.whatwg.org/multipage/#the-img-element"
/> | 4 <link rel="help" href="https://html.spec.whatwg.org/multipage/#the-img-element"
/> |
| 5 <meta name="assert" content="Tests the Image constructor for the img-element"> | 5 <meta name="assert" content="Tests the Image constructor for the img-element"> |
| 6 <script src="/resources/testharness.js"></script> | 6 <script src="/resources/testharness.js"></script> |
| 7 <script src="/resources/testharnessreport.js"></script> | 7 <script src="/resources/testharnessreport.js"></script> |
| 8 | 8 |
| 9 | 9 |
| 10 <div id="log"></div> | 10 <div id="log"></div> |
| 11 <script> | 11 <script> |
| 12 test(function() { | 12 test(function() { |
| 13 var img = new Image(); | 13 var img = new Image(); |
| 14 assert_true(img != undefined); | 14 assert_true(img != undefined); |
| 15 }, "Image constructor works"); | 15 }, "Image constructor works"); |
| 16 | 16 |
| 17 test(function() { | 17 test(function() { |
| 18 assert_true(Image.prototype === HTMLImageElement.prototype); | 18 assert_true(Image.prototype === HTMLImageElement.prototype); |
| 19 }, "Image and HTMLImageElement share a prototype"); | 19 }, "Image and HTMLImageElement share a prototype"); |
| 20 | 20 |
| 21 test(function() { | 21 test(function() { |
| 22 assert_true((new Image()).localName === "img"); | 22 assert_true((new Image()).localName === "img"); |
| 23 }, "Image localName is img"); | 23 }, "Image localName is img"); |
| 24 | 24 |
| 25 test(function() { | 25 test(function() { |
| 26 assert_true((new Image()).namespaceURI === "http://www.w3.org/1999/xhtml"); | 26 assert_true((new Image()).namespaceURI === "http://www.w3.org/1999/xhtml"); |
| 27 }, "Image namespace URI is correct"); | 27 }, "Image namespace URI is correct"); |
| 28 | 28 |
| 29 test(function() { |
| 30 assert_equals(Image.name, "Image", "Image name should be Image (not HTMLIm
ageElement)"); |
| 31 assert_equals(Image.__proto__, Function.prototype, "Image __proto__ is Fun
ction prototype"); |
| 32 assert_equals(Image.prototype, HTMLImageElement.prototype, "Image.prototyp
e is same as HTMLImageElement.prototype"); |
| 33 assert_equals(new Image().__proto__, HTMLImageElement.prototype, "Image __
proto__ is HTMLImageElement prototype "); |
| 34 assert_equals(Image.prototype.__proto__, HTMLElement.prototype, "Image.pro
totype __proto__ is HTMLElement prototype"); |
| 35 }, "NamedConstructor creates the correct object structure."); |
| 36 |
| 29 </script> | 37 </script> |
| OLD | NEW |