mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-23 15:47:30 +09:00
47 lines
1.7 KiB
HTML
47 lines
1.7 KiB
HTML
<!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.connectedCallback = 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.connectedCallback = 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>
|