|
1 <!DOCTYPE HTML> |
|
2 <html> |
|
3 <!-- |
|
4 https://bugzilla.mozilla.org/show_bug.cgi?id=783129 |
|
5 --> |
|
6 <head> |
|
7 <title>Test for document.registerElement for elements created by the parser</title> |
|
8 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
|
9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> |
|
10 <script> |
|
11 |
|
12 var extendedButtonProto = Object.create(HTMLButtonElement.prototype); |
|
13 var buttonCallbackCalled = false; |
|
14 extendedButtonProto.createdCallback = function() { |
|
15 is(buttonCallbackCalled, false, "created callback for x-button should only be called once."); |
|
16 is(this.tagName, "BUTTON", "Only the <button> element should be upgraded."); |
|
17 buttonCallbackCalled = true; |
|
18 }; |
|
19 |
|
20 document.registerElement("x-button", { prototype: extendedButtonProto, extends: "button" }); |
|
21 |
|
22 var divProto = Object.create(HTMLDivElement.prototype); |
|
23 var divCallbackCalled = false; |
|
24 divProto.createdCallback = function() { |
|
25 is(divCallbackCalled, false, "created callback for x-div should only be called once."); |
|
26 is(buttonCallbackCalled, true, "crated callback should be called for x-button before x-div."); |
|
27 is(this.tagName, "X-DIV", "Only the <x-div> element should be upgraded."); |
|
28 divCallbackCalled = true; |
|
29 SimpleTest.finish(); |
|
30 }; |
|
31 |
|
32 document.registerElement("x-div", { prototype: divProto }); |
|
33 |
|
34 SimpleTest.waitForExplicitFinish(); |
|
35 </script> |
|
36 </head> |
|
37 <body> |
|
38 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=783129">Bug 783129</a> |
|
39 <button is="x-button"></button><!-- should be upgraded --> |
|
40 <x-button></x-button><!-- should not be upgraded --> |
|
41 <span is="x-button"></span><!-- should not be upgraded --> |
|
42 <div is="x-div"></div><!-- should not be upgraded --> |
|
43 <x-div></x-div><!-- should be upgraded --> |
|
44 <script> |
|
45 </script> |
|
46 </body> |
|
47 </html> |