Fix constructor(el) instanceof HTMLElement

pull/1441/head
Simon Legner 1 year ago
parent 81c0551d35
commit 864e45e6fb

@ -54,8 +54,7 @@ app.views.Mobile = class Mobile extends app.View {
}
constructor() {
super(...arguments);
this.el = document.documentElement;
super(document.documentElement);
}
init() {

@ -25,8 +25,7 @@ app.views.ListFocus = class ListFocus extends app.View {
}
constructor(el) {
super(...arguments);
this.el = el;
super(el);
this.focusOnNextFrame = $.framify(this.focus, this);
}

@ -22,11 +22,6 @@ app.views.ListFold = class ListFold extends app.View {
};
}
constructor(el) {
super(...arguments);
this.el = el;
}
open(el) {
if (el && !el.classList.contains(this.constructor.activeClass)) {
el.classList.add(this.constructor.activeClass);

@ -15,11 +15,6 @@ app.views.ListSelect = class ListSelect extends app.View {
this.events = { click: "onClick" };
}
constructor(el) {
super(...arguments);
this.el = el;
}
deactivate() {
if (super.deactivate(...arguments)) {
this.deselect();

@ -18,16 +18,13 @@
}
constructor(data) {
let base;
super();
this.onClick = this.onClick.bind(this);
let base = this.constructor.events || (this.constructor.events = {});
this.data = data;
if (
(base = this.constructor.events || (this.constructor.events = {}))
.click == null
) {
if (base.click == null) {
base.click = "onClick";
}
super(...arguments);
}
renderPaginated() {

@ -14,9 +14,9 @@ app.views.Notice = class Notice extends app.View {
}
constructor(type, ...rest) {
super();
this.type = type;
[...this.args] = Array.from(rest);
super(...arguments);
}
init() {

@ -19,7 +19,7 @@ app.views.Notif = class Notif extends app.View {
}
constructor(type, options) {
super(...arguments);
super();
this.type = type;
this.options = $.extend({}, this.constructor.defaultOptions, options || {});
}

@ -10,8 +10,7 @@
*/
app.views.BasePage = class BasePage extends app.View {
constructor(el, entry) {
super(...arguments);
this.el = el;
super(el);
this.entry = entry;
}

@ -12,8 +12,7 @@ app.views.HiddenPage = class HiddenPage extends app.View {
}
constructor(el, entry) {
super(...arguments);
this.el = el;
super(el);
this.entry = entry;
}

@ -32,11 +32,6 @@
HASH_RGX = new RegExp(`^#${SEARCH_PARAM}=(.+?) .`);
}
constructor(el) {
super(...arguments);
this.el = el;
}
init() {
this.placeholder = this.input.getAttribute("placeholder");

@ -16,8 +16,8 @@ app.views.EntryList = class EntryList extends app.views.PaginatedList {
}
constructor(entries) {
this.entries = entries;
super(...arguments);
this.entries = entries;
}
init() {

@ -18,9 +18,11 @@ app.views.Results = class Results extends app.View {
}
constructor(sidebar, search) {
super(...arguments);
super();
this.sidebar = sidebar;
this.search = search;
this.init0();
this.refreshElements();
}
deactivate() {
@ -29,7 +31,7 @@ app.views.Results = class Results extends app.View {
}
}
init() {
init0() {
this.addSubview((this.listFocus = new app.views.ListFocus(this.el)));
this.addSubview((this.listSelect = new app.views.ListSelect(this.el)));

@ -26,8 +26,7 @@ app.views.SidebarHover = class SidebarHover extends app.View {
}
constructor(el) {
super(...arguments);
this.el = el;
super(el);
if (!isPointerEventsSupported()) {
delete this.constructor.events.mouseover;
}

@ -21,7 +21,7 @@ app.views.TypeList = class TypeList extends app.View {
}
constructor(doc) {
super(...arguments);
super();
this.doc = doc;
}

@ -13,7 +13,10 @@ app.View = class View {
$.extend(this.prototype, Events);
}
constructor() {
constructor(el) {
if (el instanceof HTMLElement) {
this.el = el;
}
this.setupElement();
if (this.el.className) {
this.originalClassName = this.el.className;

Loading…
Cancel
Save