mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-20 15:27:32 +09:00
Bug 1378079 - Part 3: Complete the steps related to custom elements in "create an element for a token".
With fixup for missing header due to unified builds. Tag UXP Issue #1344
This commit is contained in:
parent
ed18cbb741
commit
5d26d32825
8 changed files with 203 additions and 141 deletions
|
|
@ -10,6 +10,7 @@ support-files =
|
|||
[test_content_element.html]
|
||||
[test_custom_element_adopt_callbacks.html]
|
||||
[test_custom_element_callback_innerhtml.html]
|
||||
skip-if = true # disabled - See bug 1390396
|
||||
[test_custom_element_clone_callbacks_extended.html]
|
||||
[test_custom_element_htmlconstructor.html]
|
||||
skip-if = os == 'android' # bug 1323645
|
||||
|
|
@ -20,6 +21,7 @@ support-files =
|
|||
[test_custom_element_in_shadow.html]
|
||||
skip-if = true || stylo # disabled - See bug 1390396 and 1293844
|
||||
[test_custom_element_register_invalid_callbacks.html]
|
||||
[test_custom_element_throw_on_dynamic_markup_insertion.html]
|
||||
[test_custom_element_get.html]
|
||||
[test_custom_element_when_defined.html]
|
||||
[test_nested_content_element.html]
|
||||
|
|
@ -31,7 +33,6 @@ skip-if = true || stylo # disabled - See bug 1390396 and 1293844
|
|||
[test_document_adoptnode.html]
|
||||
[test_document_importnode.html]
|
||||
[test_document_register.html]
|
||||
[test_document_register_base_queue.html]
|
||||
[test_document_register_lifecycle.html]
|
||||
skip-if = true # disabled - See bug 1390396
|
||||
[test_document_register_parser.html]
|
||||
|
|
|
|||
|
|
@ -1,48 +0,0 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=783129
|
||||
-->
|
||||
<head>
|
||||
<title>Test for document.registerElement lifecycle callback</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
<script>
|
||||
var p = Object.create(HTMLElement.prototype);
|
||||
|
||||
var createdCallbackCallCount = 0;
|
||||
|
||||
// By the time the base element queue is processed via the microtask,
|
||||
// both x-hello elements should be in the document.
|
||||
p.createdCallback = function() {
|
||||
var one = document.getElementById("one");
|
||||
var two = document.getElementById("two");
|
||||
isnot(one, null, "First x-hello element should be in the tree.");
|
||||
isnot(two, null, "Second x-hello element should be in the tree.");
|
||||
createdCallbackCallCount++;
|
||||
if (createdCallbackCallCount == 2) {
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
if (createdCallbackCallCount > 2) {
|
||||
ok(false, "Created callback called too much.");
|
||||
}
|
||||
};
|
||||
|
||||
p.attributeChangedCallback = function(name, oldValue, newValue) {
|
||||
ok(false, "Attribute changed callback should not be called because callbacks should not be queued until created callback invoked.");
|
||||
};
|
||||
|
||||
document.registerElement("x-hello", { prototype: p });
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=783129">Bug 783129</a>
|
||||
<x-hello id="one"></x-hello>
|
||||
<x-hello id="two"></x-hello>
|
||||
<script>
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -11,7 +11,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=783129
|
|||
|
||||
var extendedButtonProto = Object.create(HTMLButtonElement.prototype);
|
||||
var buttonCallbackCalled = false;
|
||||
extendedButtonProto.createdCallback = function() {
|
||||
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;
|
||||
|
|
@ -21,7 +21,7 @@ document.registerElement("x-button", { prototype: extendedButtonProto, extends:
|
|||
|
||||
var divProto = Object.create(HTMLDivElement.prototype);
|
||||
var divCallbackCalled = false;
|
||||
divProto.createdCallback = function() {
|
||||
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.");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue