Bug 1797139 - Don't null out l10n from destructor(). r=dholbert,Gijs

destructor() should really clean-up after setup(), not the
constructor(), since setup() can be called multiple times.

Differential Revision: https://phabricator.services.mozilla.com/D160332
This commit is contained in:
Emilio Cobos Álvarez 2022-10-26 11:10:38 +00:00
Родитель eb83c140a5
Коммит 33f548e9da
3 изменённых файлов: 13 добавлений и 3 удалений

Просмотреть файл

@ -0,0 +1,2 @@
<!doctype html>
<input type="datetime-local">

Просмотреть файл

@ -0,0 +1,9 @@
<!doctype html>
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1797139">
<link rel="match" href="datetime-dynamic-type-change-ref.html">
<input type="date">
<script>
onload = function() {
document.querySelector("input").type = "datetime-local";
}
</script>

Просмотреть файл

@ -17,7 +17,6 @@ this.DateTimeBoxWidget = class {
this.element = shadowRoot.host;
this.document = this.element.ownerDocument;
this.window = this.document.defaultView;
// The DOMLocalization instance needs to allow for sync methods so that
// the placeholder value may be determined and set during the
// createEditFieldAndAppend() call.
@ -25,7 +24,6 @@ this.DateTimeBoxWidget = class {
["toolkit/global/datetimebox.ftl"],
/* aSync = */ true
);
this.l10n.connectRoot(this.shadowRoot);
}
/*
@ -77,7 +75,6 @@ this.DateTimeBoxWidget = class {
});
this.l10n.disconnectRoot(this.shadowRoot);
this.l10n = null;
this.removeEditFields();
@ -132,6 +129,8 @@ this.DateTimeBoxWidget = class {
setup() {
this.DEBUG = false;
this.l10n.connectRoot(this.shadowRoot);
this.generateContent();
this.mDateTimeBoxElement = this.shadowRoot.firstChild;