|
1 <!DOCTYPE HTML> |
|
2 <html> |
|
3 <!-- |
|
4 https://bugzilla.mozilla.org/show_bug.cgi?id=817420 |
|
5 --> |
|
6 <head> |
|
7 <meta charset="utf-8"> |
|
8 <title>Test for Bug 817420</title> |
|
9 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
|
10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> |
|
11 </head> |
|
12 <body> |
|
13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=817420">Mozilla Bug 817420</a> |
|
14 <p id="display"></p> |
|
15 <div id="content" style="display: none"> |
|
16 |
|
17 </div> |
|
18 <pre id="test"> |
|
19 <script type="application/javascript"> |
|
20 |
|
21 /** Test for Bug 817420 **/ |
|
22 is(Object.getPrototypeOf(HTMLElement.prototype), Element.prototype, |
|
23 "Must have correct proto chain for HTMLElement.prototype"); |
|
24 is(Object.getPrototypeOf(document.createElementNS(null, "x")), |
|
25 Element.prototype, |
|
26 "Must have correct proto chain for random element"); |
|
27 is(Object.getPrototypeOf(document.createElement("noSuchElementName")), |
|
28 HTMLUnknownElement.prototype, |
|
29 "Must have correct proto chain for random HTML element"); |
|
30 |
|
31 // And check that it's really working as it should |
|
32 function checkPropPresent(propName, objList, expected) |
|
33 { |
|
34 for (obj of objList) { |
|
35 is(propName in obj, |
|
36 expected, |
|
37 obj + " should " + (expected ? "" : "not ") + "have the property"); |
|
38 } |
|
39 } |
|
40 var objList = [ Element.prototype, |
|
41 HTMLElement.prototype, |
|
42 document.createElementNS(null, "x"), |
|
43 document.createElement("noSuchElementName"), |
|
44 document.body ] |
|
45 checkPropPresent("somePropertyThatBetterNeverExist", objList, false); |
|
46 Element.prototype.somePropertyThatBetterNeverExist = 1; |
|
47 checkPropPresent("somePropertyThatBetterNeverExist", objList, true); |
|
48 |
|
49 objList = [ HTMLElement.prototype, |
|
50 document.createElement("noSuchElementName"), |
|
51 document.body ] |
|
52 checkPropPresent("someOtherPropertyThatBetterNeverExist", objList, false); |
|
53 HTMLElement.prototype.someOtherPropertyThatBetterNeverExist = 1; |
|
54 checkPropPresent("someOtherPropertyThatBetterNeverExist", objList, true); |
|
55 |
|
56 </script> |
|
57 </pre> |
|
58 </body> |
|
59 </html> |