History

Sanity-check decaffeinate app.views.Results

Simon Legner committed 2 years ago

Commit cf412bd1 parent 92b18281 file · +6 −24Browse files

Unified · Split

assets/javascripts/views/sidebar/results.js+6−24
@@ -1,20 +1,9 @@
1−// TODO: This file was created by bulk-decaffeinate.
2−// Sanity-check the conversion and remove this comment.
3−/*
4− * decaffeinate suggestions:
5− * DS102: Remove unnecessary code created because of implicit returns
6− * DS206: Consider reworking classes to avoid initClass
7− * DS207: Consider shorter variations of null checks
8− * Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md
9− */
101 app.views.Results = class Results extends app.View {
11− static initClass() {
12− this.className = "_list";
2+ static className = "_list";
133
14− this.events = { click: "onClick" };
4+ static events = { click: "onClick" };
155
16− this.routes = { after: "afterRoute" };
17− }
6+ static routes = { after: "afterRoute" };
187
198 constructor(sidebar, search) {
209 super();
@@ -42,9 +31,7 @@ app.views.Results = class Results extends app.View { · 21 unmodified lines
4231
4332 onResults(entries, flags) {
4433 if (flags.initialResults) {
45− if (this.listFocus != null) {
46− this.listFocus.blur();
47− }
34+ this.listFocus?.blur();
4835 }
4936 if (flags.initialResults) {
5037 this.empty();
@@ -70,16 +57,12 @@ app.views.Results = class Results extends app.View { · 19 unmodified lines
7057
7158 focusFirst() {
7259 if (!app.isMobile()) {
73− if (this.listFocus != null) {
74− this.listFocus.focusOnNextFrame(this.el.firstElementChild);
75− }
60+ this.listFocus?.focusOnNextFrame(this.el.firstElementChild);
7661 }
7762 }
7863
7964 openFirst() {
80− if (this.el.firstElementChild != null) {
81− this.el.firstElementChild.click();
82− }
65+ this.el.firstElementChild?.click();
8366 }
8467
8568 onDocEnabled(doc) {
@@ -109,4 +92,3 @@ app.views.Results = class Results extends app.View { · 23 unmodified lines
10992 }
11093 }
11194 };
112−app.views.Results.initClass();