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