Fix constructor(el) instanceof HTMLElement

pull/1441/head
Simon Legner 1 year ago
parent 5e0b6a4e59
commit 63472e840e

@ -19,11 +19,10 @@
constructor(data) {
super();
this.onClick = this.onClick.bind(this);
let base = this.constructor.events || (this.constructor.events = {});
this.data = data;
if (base.click == null) {
base.click = "onClick";
this.constructor.events = this.constructor.events || {};
if (this.constructor.events.click == null) {
this.constructor.events.click = "onClick";
}
}

@ -3,7 +3,6 @@
/*
* decaffeinate suggestions:
* DS002: Fix invalid constructor
* DS101: Remove unnecessary use of Array.from
* DS206: Consider reworking classes to avoid initClass
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md
*/
@ -13,13 +12,15 @@ app.views.Notice = class Notice extends app.View {
this.attributes = { role: "alert" };
}
constructor(type, ...rest) {
constructor(type, ...args) {
super();
this.type = type;
[...this.args] = Array.from(rest);
this.args = args || [];
this.init0(); // needs this.args
this.refreshElements();
}
init() {
init0() {
this.activate();
}
@ -36,7 +37,7 @@ app.views.Notice = class Notice extends app.View {
}
show() {
this.html(this.tmpl(`${this.type}Notice`, ...Array.from(this.args)));
this.html(this.tmpl(`${this.type}Notice`, ...this.args));
this.prependTo(app.el);
}

@ -18,9 +18,11 @@ app.views.EntryList = class EntryList extends app.views.PaginatedList {
constructor(entries) {
super(...arguments);
this.entries = entries;
this.init0(); // needs this.data from PaginatedList
this.refreshElements();
}
init() {
init0() {
this.renderPaginated();
this.activate();
}

@ -21,7 +21,7 @@ app.views.Results = class Results extends app.View {
super();
this.sidebar = sidebar;
this.search = search;
this.init0();
this.init0(); // needs this.search
this.refreshElements();
}

@ -23,9 +23,11 @@ app.views.TypeList = class TypeList extends app.View {
constructor(doc) {
super();
this.doc = doc;
this.init0(); // needs this.doc
this.refreshElements();
}
init() {
init0() {
this.lists = {};
this.render();
this.activate();

Loading…
Cancel
Save