Sanity-check decaffeinate app.views.ListSelect

pull/1441/head
Simon Legner 1 year ago
parent b07fd01ab1
commit 9073fa20cb

@ -1,18 +1,7 @@
// TODO: This file was created by bulk-decaffeinate.
// Sanity-check the conversion and remove this comment.
/*
* decaffeinate suggestions:
* DS102: Remove unnecessary code created because of implicit returns
* DS103: Rewrite code to no longer use __guard__, or convert again using --optional-chaining
* DS206: Consider reworking classes to avoid initClass
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md
*/
app.views.ListSelect = class ListSelect extends app.View { app.views.ListSelect = class ListSelect extends app.View {
static initClass() { static activeClass = "active";
this.activeClass = "active";
this.events = { click: "onClick" }; static events = { click: "onClick" };
}
deactivate() { deactivate() {
if (super.deactivate(...arguments)) { if (super.deactivate(...arguments)) {
@ -37,9 +26,7 @@ app.views.ListSelect = class ListSelect extends app.View {
} }
selectByHref(href) { selectByHref(href) {
if ( if (this.getSelection()?.getAttribute("href") !== href) {
__guard__(this.getSelection(), (x) => x.getAttribute("href")) !== href
) {
this.select(this.find(`a[href='${href}']`)); this.select(this.find(`a[href='${href}']`));
} }
} }
@ -62,10 +49,3 @@ app.views.ListSelect = class ListSelect extends app.View {
} }
} }
}; };
app.views.ListSelect.initClass();
function __guard__(value, transform) {
return typeof value !== "undefined" && value !== null
? transform(value)
: undefined;
}

Loading…
Cancel
Save