diff --git a/web/pdf_find_controller.js b/web/pdf_find_controller.js index 100dee201..bc99e1f61 100644 --- a/web/pdf_find_controller.js +++ b/web/pdf_find_controller.js @@ -771,7 +771,7 @@ class PDFFindController { total = this._matchesCountTotal; if (matchIdx !== -1) { for (let i = 0; i < pageIdx; i++) { - current += (this._pageMatches[i] && this._pageMatches[i].length) || 0; + current += this._pageMatches[i]?.length || 0; } current += matchIdx + 1; } @@ -797,7 +797,7 @@ class PDFFindController { state, previous, matchesCount: this._requestMatchesCount(), - rawQuery: this._state ? this._state.query : null, + rawQuery: this._state?.query ?? null, }); } } diff --git a/web/pdf_sidebar_resizer.js b/web/pdf_sidebar_resizer.js index 6a255ab78..b97a1be7f 100644 --- a/web/pdf_sidebar_resizer.js +++ b/web/pdf_sidebar_resizer.js @@ -53,10 +53,7 @@ class PDFSidebarResizer { * @type {number} */ get outerContainerWidth() { - if (!this._outerContainerWidth) { - this._outerContainerWidth = this.outerContainer.clientWidth; - } - return this._outerContainerWidth; + return (this._outerContainerWidth ||= this.outerContainer.clientWidth); } /** @@ -135,7 +132,7 @@ class PDFSidebarResizer { this.eventBus._on("resize", evt => { // When the *entire* viewer is resized, such that it becomes narrower, // ensure that the sidebar doesn't end up being too wide. - if (!evt || evt.source !== window) { + if (evt?.source !== window) { return; } // Always reset the cached width when the viewer is resized.