diff --git a/source/components/datatable/columnbar.mjs b/source/components/datatable/columnbar.mjs index 10f11497bfb5c2e68892e06fa1e35afeb0d638f0..349206876fb42434bfc8c29e9c158f36e6f5af90 100644 --- a/source/components/datatable/columnbar.mjs +++ b/source/components/datatable/columnbar.mjs @@ -153,7 +153,6 @@ class ColumnBar extends CustomElement { * @return {Monster.Components.Datatable.Form} */ function initControlReferences() { - if (!this.shadowRoot) { throw new Error("no shadow-root is defined"); } diff --git a/source/components/datatable/dataset.mjs b/source/components/datatable/dataset.mjs index 9bbfa7c972ed9ebdf92bfcdaa2f24786bc06f274..39d2c03676d02458f0cb64b8d0d3cfcdda384a91 100644 --- a/source/components/datatable/dataset.mjs +++ b/source/components/datatable/dataset.mjs @@ -175,7 +175,6 @@ class DataSet extends CustomElement { * @private */ function initEventHandler() { - this[attributeObserverSymbol][ATTRIBUTE_DATATABLE_INDEX] = () => { const index = this.getAttribute(ATTRIBUTE_DATATABLE_INDEX); if (index) { @@ -189,7 +188,6 @@ function initEventHandler() { * @param {Onject} options */ function updateOptionsFromArguments(options) { - const index = this.getAttribute(ATTRIBUTE_DATATABLE_INDEX); if (index !== null && index !== undefined) { diff --git a/source/components/datatable/datasource/dom.mjs b/source/components/datatable/datasource/dom.mjs index ba3170f7916dc1e06dfc2e63e27ffc1b50c39108..c91ebef096f5555187f997754537660ff9e2ead7 100644 --- a/source/components/datatable/datasource/dom.mjs +++ b/source/components/datatable/datasource/dom.mjs @@ -115,7 +115,6 @@ class Dom extends Datasource { * @private */ function initEventHandler() { - /** * @param {Event} event */ @@ -134,7 +133,6 @@ function initEventHandler() { * @private */ function updateDataSource() { - let data = null; getSlottedElements.call(this).forEach((element) => { if (!(element instanceof HTMLScriptElement)) { diff --git a/source/components/datatable/datasource/rest.mjs b/source/components/datatable/datasource/rest.mjs index f8cdffd9961f47d33d00eb697ed524ea89f1ed83..f797018e41d2adcc487032ff24ca90fc14534e6c 100644 --- a/source/components/datatable/datasource/rest.mjs +++ b/source/components/datatable/datasource/rest.mjs @@ -177,7 +177,6 @@ class Rest extends Datasource { * @returns {Promise<never>|*} */ fetch() { - const opt = clone(this.getOption("read")); this[dataSourceSymbol].setOption("read", opt); @@ -319,7 +318,6 @@ function initFilter() { * @private */ function initAutoInit() { - const autoInit = this.getOption("features.autoInit"); validateBoolean(autoInit); @@ -348,7 +346,6 @@ function initAutoInit() { } function initEventHandler() { - this[intersectionObserverHandlerSymbol] = (entries) => { entries.forEach((entry) => { if (entry.isIntersecting) { @@ -369,7 +366,6 @@ function initEventHandler() { } function initIntersectionObserver() { - this.classList.add("intersection-observer"); const options = { diff --git a/source/components/datatable/datatable.mjs b/source/components/datatable/datatable.mjs index b08cf5d250fafe8cf67d2c4d6a276b47b5fb6b87..152c3953c560df95b9d96104155918a8608de501 100644 --- a/source/components/datatable/datatable.mjs +++ b/source/components/datatable/datatable.mjs @@ -219,7 +219,6 @@ class DataTable extends CustomElement { * @return {Monster.Components.Form.Form} */ [assembleMethodSymbol]() { - const rawKey = this.getOption("templateMapping.row-key"); if (rawKey === null) { @@ -381,7 +380,6 @@ function updateColumnBar() { * @private */ function updateHeaderFromColumnBar() { - if (!this[columnBarElementSymbol]) { return; } @@ -415,7 +413,6 @@ function updateHeaderFromColumnBar() { * @private */ function updateConfigColumnBar() { - if (!this[columnBarElementSymbol]) { return; } @@ -497,7 +494,6 @@ function initEventHandler() { * @private */ function initGridAndStructs(hostConfig) { - const rowID = this.getOption("templateMapping.row-key"); if (!this[gridElementSymbol]) { @@ -619,7 +615,6 @@ function initGridAndStructs(hostConfig) { * @private */ function updateGrid() { - if (!this[gridElementSymbol]) { throw new Error("no grid element is defined"); } @@ -688,7 +683,6 @@ function setDataSource({ orderBy }, doFetch) { * @return {Monster.Components.Datatable.Form} */ function initControlReferences() { - if (!this.shadowRoot) { throw new Error("no shadow-root is defined"); } @@ -712,7 +706,6 @@ function initControlReferences() { * @throws {Error} the datasource could not be initialized */ function initOptionsFromArguments() { - const options = {}; const selector = this.getAttribute(ATTRIBUTE_DATASOURCE_SELECTOR); diff --git a/source/components/datatable/datatable/header.mjs b/source/components/datatable/datatable/header.mjs index ef01b060c6d5c6a41b9c6197e48e374b83304d0d..870e1c4ea309aa10deca416f415ca566943fcb33 100644 --- a/source/components/datatable/datatable/header.mjs +++ b/source/components/datatable/datatable/header.mjs @@ -99,7 +99,6 @@ class Header extends Base { } changeDirection() { - let direction = this.getInternal("direction"); if (direction === DIRECTION_ASC) { direction = DIRECTION_DESC; @@ -243,7 +242,6 @@ function createOrderStatement(headers) { * @private */ function updateStruct() { - const label = this.getInternal("label"); const direction = this.getInternal("direction"); const field = this.getInternal("field"); diff --git a/source/components/datatable/filter.mjs b/source/components/datatable/filter.mjs index fe28cfb8dae07751f678093d50aa8d32d0f7c5c1..518410ddd80cb07ed16a934519abcbbb0c796e0d 100644 --- a/source/components/datatable/filter.mjs +++ b/source/components/datatable/filter.mjs @@ -269,7 +269,6 @@ class Filter extends CustomElement { * @return {FilterButton} */ function initControlReferences() { - if (!this.shadowRoot) { throw new Error("no shadow-root is defined"); } @@ -294,7 +293,6 @@ function initControlReferences() { * @throws {Error} no filter label is defined */ function initFilter() { - const storedConfig = this[settingsSymbol]; this[settingsSymbol] = new Settings(); @@ -500,7 +498,6 @@ function initEventHandler() { * @private */ function doSearch({ showEffect } = { showEffect: true }) { - this.resetFailureMessage(); if (showEffect) { @@ -556,7 +553,6 @@ function doSearch({ showEffect } = { showEffect: true }) { * @returns {string|undefind} */ function buildSearchQuery(queries) { - if (!isArray(queries) || queries.length === 0) { return this.getOption("defaultQuery"); } @@ -579,7 +575,6 @@ function buildSearchQuery(queries) { * @returns {Promise<unknown>} */ function collectSearchQueries() { - const currentHash = parseBracketedKeyValueHash(getGlobal().location.hash); return new Promise((resolve, reject) => { @@ -841,7 +836,6 @@ function getFilterConfigKey() { * @returns {Promise<unknown>} */ function initFromConfig() { - const document = getDocument(); const host = document.querySelector("monster-host"); @@ -876,7 +870,6 @@ function initFromConfig() { * @private */ function updateConfig() { - const document = getDocument(); const host = document.querySelector("monster-host"); if (!(host && this.id)) { diff --git a/source/components/datatable/filter/date-range.mjs b/source/components/datatable/filter/date-range.mjs index adaf869e35227990fc95f02a5dafb1a4078ab4b4..51277a21d767b1cf959394e42f2502c9d1a254b5 100644 --- a/source/components/datatable/filter/date-range.mjs +++ b/source/components/datatable/filter/date-range.mjs @@ -312,7 +312,6 @@ class DateRange extends AbstractBase { * @param {string} type */ function updateMainFilterValueFromPopperChange(group, type) { - function calculateTargetDate(diff) { if (isNaN(diff)) { diff = 0; @@ -406,7 +405,6 @@ function updateMainFilterValueFromPopperChange(group, type) { * @return {initEventHandler} */ function initEventHandler() { - this[closeEventHandler] = (event) => { const path = event.composedPath(); @@ -537,7 +535,6 @@ function initEventHandler() { * @private */ function attachResizeObserver() { - // against flickering this[resizeObserverSymbol] = new ResizeObserver((entries) => { if (this[timerCallbackSymbol] instanceof DeadMansSwitch) { @@ -567,7 +564,6 @@ function disconnectResizeObserver() { * @private */ function hide() { - this[popperElementSymbol].style.display = "none"; removeAttributeToken(this[controlElementSymbol], "class", "open"); } @@ -577,7 +573,6 @@ function hide() { * @this PopperButton */ function show() { - if (this.getOption("disabled", false) === true) { return; } @@ -606,7 +601,6 @@ function show() { * @private */ function clearAndDisableFormGroups() { - this[radioInputsElementSymbol].forEach((radio) => { radio.checked = false; }); @@ -627,7 +621,6 @@ function clearAndDisableFormGroups() { * @returns {string} */ function guessRangeTypeFromCurrentValue() { - const value = this[inputElementSymbol].value.trim(); if (value === "") { @@ -659,7 +652,6 @@ function guessRangeTypeFromCurrentValue() { } function getRangeTypeFromForm() { - const group = this[formContainerElementSymbol].querySelector( "input[type=radio][name=rangeType]:checked", ); @@ -715,7 +707,6 @@ function calculateDateRangeFromToday(date, unit) { * @private */ function updatePopperInputsFromMainValue() { - const featuresMoreThan = this.getOption("features.moreThan", false); const featuresWithin = this.getOption("features.within", false); @@ -887,7 +878,6 @@ function updatePopperInputsFromMainValue() { * @return {Monster.Components.Datatable.Filter.Range} */ function initControlReferences() { - if (!this.shadowRoot) { throw new Error("no shadow-root is defined"); } @@ -927,7 +917,6 @@ function initControlReferences() { * @return {object} */ function initOptionsFromArguments(options) { - return options; } @@ -935,7 +924,6 @@ function initOptionsFromArguments(options) { * @private */ function updatePopper() { - if (this[popperElementSymbol].style.display !== STYLE_DISPLAY_MODE_BLOCK) { return; } diff --git a/source/components/datatable/filter/input.mjs b/source/components/datatable/filter/input.mjs index ef7430e6e07cae49dc37aec5a30ce95587258047..5ba6984e0846431633c7b1df83f1bd821736da73 100644 --- a/source/components/datatable/filter/input.mjs +++ b/source/components/datatable/filter/input.mjs @@ -141,7 +141,6 @@ class Input extends AbstractBase { * @return {FilterButton} */ function initControlReferences() { - if (!this.shadowRoot) { throw new Error("no shadow-root is defined"); } diff --git a/source/components/datatable/filter/range.mjs b/source/components/datatable/filter/range.mjs index 6bb09c0cde639ee3a9d6d154b234896390f1ae8c..42846b90f2701ec6fa7619252127524299e8800c 100644 --- a/source/components/datatable/filter/range.mjs +++ b/source/components/datatable/filter/range.mjs @@ -320,7 +320,6 @@ function updateFilterValue(type, self, value, element) { * @return {initEventHandler} */ function initEventHandler() { - this[closeEventHandler] = (event) => { const path = event.composedPath(); @@ -451,7 +450,6 @@ function initEventHandler() { * @private */ function attachResizeObserver() { - // against flickering this[resizeObserverSymbol] = new ResizeObserver((entries) => { if (this[timerCallbackSymbol] instanceof DeadMansSwitch) { @@ -481,7 +479,6 @@ function disconnectResizeObserver() { * @private */ function hide() { - this[popperElementSymbol].style.display = "none"; removeAttributeToken(this[controlElementSymbol], "class", "open"); } @@ -491,7 +488,6 @@ function hide() { * @this PopperButton */ function show() { - if (this.getOption("disabled", false) === true) { return; } @@ -564,7 +560,6 @@ function updateInputFromValue() { * @return {Monster.Components.Datatable.Filter.Range} */ function initControlReferences() { - if (!this.shadowRoot) { throw new Error("no shadow-root is defined"); } @@ -594,7 +589,6 @@ function initControlReferences() { * @return {object} */ function initOptionsFromArguments(options) { - return options; } @@ -602,7 +596,6 @@ function initOptionsFromArguments(options) { * @private */ function updatePopper() { - if (this[popperElementSymbol].style.display !== STYLE_DISPLAY_MODE_BLOCK) { return; } diff --git a/source/components/datatable/filter/settings.mjs b/source/components/datatable/filter/settings.mjs index 7ae8d2731c31321d6f02be1ba56a998e83f4dd48..4026401273c1d6da90e8bf519a2430e1a67e2599 100644 --- a/source/components/datatable/filter/settings.mjs +++ b/source/components/datatable/filter/settings.mjs @@ -44,7 +44,6 @@ class Settings extends Base { * @returns {Settings} */ set({ value, label, visible = true }) { - let d = this.getInternal("option." + value); if (d) { if (d.label !== label && label) { diff --git a/source/components/datatable/pagination.mjs b/source/components/datatable/pagination.mjs index 5d9976f11819bd556149d7b520be6442be4b17f3..f00d7d350c6131b676460c72cceab95453985c18 100644 --- a/source/components/datatable/pagination.mjs +++ b/source/components/datatable/pagination.mjs @@ -197,7 +197,6 @@ class Pagination extends CustomElement { * @throws {Error} no shadow-root is defined */ function initControlReferences() { - if (!this.shadowRoot) { throw new Error("no shadow-root is defined"); } @@ -329,7 +328,6 @@ function handleDataSourceChanges() { * @returns {object} */ function buildPagination(current, max) { - let prev = current === 1 ? null : current - 1; let next = current === max ? null : current + 1; const itemList = [1]; diff --git a/source/components/datatable/util.mjs b/source/components/datatable/util.mjs index 50afae85c18844b2ebf0c0377f633209017ebad8..cc63d365dfb25fd20a32f32b53296271f2b70709 100644 --- a/source/components/datatable/util.mjs +++ b/source/components/datatable/util.mjs @@ -19,7 +19,6 @@ const datasourceLinkedElementSymbol = Symbol("datasourceLinkedElement"); * @private */ function handleDataSourceChanges() { - if (!this[datasourceLinkedElementSymbol]) { return; } diff --git a/source/components/form/action-button.mjs b/source/components/form/action-button.mjs index 500f652300fe670e1fa3846a409b72d8c9bf2366..22fe24300d4adaf941c3ce3bbd8dae59d5df3780 100644 --- a/source/components/form/action-button.mjs +++ b/source/components/form/action-button.mjs @@ -153,7 +153,6 @@ class ActionButton extends PopperButton { * @return {Monster.Components.Form.Popper} */ function initEventHandler() { - this[containerElementSymbol].addEventListener("click", (event) => { const element = findTargetElementFromEvent(event, ATTRIBUTE_ROLE, "button"); const attr = element.getAttribute("data-monster-insert-reference"); diff --git a/source/components/form/api-button.mjs b/source/components/form/api-button.mjs index 4cd5de8cbc4716bae1f8f59db0938ae73985c321..98df3dc38bdabf91e12f8ca87a690586c01085c5 100644 --- a/source/components/form/api-button.mjs +++ b/source/components/form/api-button.mjs @@ -159,7 +159,6 @@ class ApiButton extends ActionButton { * @return {Promise} */ fetch(url) { - if (url instanceof URL) { url = url.toString(); } @@ -189,7 +188,6 @@ class ApiButton extends ActionButton { * @throws {Error} missing label configuration */ importButtons(data) { - const mappingOptions = this.getOption("mapping", {}); const selector = mappingOptions?.["selector"]; const labelSelector = mappingOptions?.["labelSelector"]; @@ -451,7 +449,6 @@ function executeAPIButton(event, button, element) { * @throws {TypeError} unsupported response */ function fetchData(url) { - if (!url) url = this.getOption("url"); if (!url) return Promise.resolve(); @@ -482,7 +479,6 @@ function fetchData(url) { * @return {Monster.Components.Form.Popper} */ function initEventHandler() { - this[containerElementSymbol].addEventListener("click", (event) => { const element = findTargetElementFromEvent( event, diff --git a/source/components/form/button-bar.mjs b/source/components/form/button-bar.mjs index d72120587281fceb9d50aedc668580583d0434b3..64311bc14a05ffdd287c85752b343f1e3af9d4c5 100644 --- a/source/components/form/button-bar.mjs +++ b/source/components/form/button-bar.mjs @@ -304,7 +304,6 @@ class ButtonBar extends CustomElement { * @returns {*} */ function initDefaultsFromAttributes(obj) { - if (this.hasAttribute(ATTRIBUTE_POPPER_POSITION)) { obj.popper.placement = this.getAttribute(ATTRIBUTE_POPPER_POSITION); } @@ -376,14 +375,12 @@ function initEventhandler() { } function initSlotChangedHandler() { - this[buttonBarElementSymbol].addEventListener("slotchange", () => { updateResizeObserverObservation.call(this); }); } function checkAndRearrangeButtons() { - if (this[dimensionsSymbol].getVia("data.calculated", false) !== true) { calculateButtonBarDimensions.call(this); } @@ -396,7 +393,6 @@ function checkAndRearrangeButtons() { * @return {Object} */ function rearrangeButtons() { - const switchWidth = this[switchElementSymbol].offsetWidth; let sum = switchWidth; @@ -477,7 +473,6 @@ function calcBoxWidth(node) { * @return {Object} */ function calculateButtonBarDimensions() { - const computedStyle = getComputedStyle(this.parentElement); if (computedStyle === null) { throw new Error("no computed style"); @@ -547,7 +542,6 @@ function calculateButtonBarDimensions() { * @private */ function updateResizeObserverObservation() { - this[resizeObserverSymbol].disconnect(); const slottedNodes = getSlottedElements.call(this); @@ -583,7 +577,6 @@ function toggle() { * @private */ function hide() { - this[popperElementSymbol].style.display = "none"; removeAttributeToken(this[controlElementSymbol], "class", "open"); } @@ -593,7 +586,6 @@ function hide() { * @this PopperButton */ function show() { - if (this.getOption("disabled", false) === true) { return; } @@ -614,7 +606,6 @@ function show() { * @private */ function updatePopper() { - if (this[popperElementSymbol].style.display !== STYLE_DISPLAY_MODE_BLOCK) { return; } @@ -637,7 +628,6 @@ function updatePopper() { * @throws {Error} no shadow-root is defined */ function initControlReferences() { - if (!this.shadowRoot) { throw new Error("no shadow-root is defined"); } @@ -675,7 +665,6 @@ function initControlReferences() { * */ function initButtonBar() { - if (!this.shadowRoot) { throw new Error("no shadow-root is defined"); } @@ -689,7 +678,6 @@ function initButtonBar() { * @private */ function initPopperSwitch() { - /** * @param {Event} event */ diff --git a/source/components/form/confirm-button.mjs b/source/components/form/confirm-button.mjs index f0124d7f1aad1e268e494ddb173b327724050403..ad95c494535a51ba404a26ba2e94c6a2bcac15f7 100644 --- a/source/components/form/confirm-button.mjs +++ b/source/components/form/confirm-button.mjs @@ -112,7 +112,6 @@ class ConfirmButton extends PopperButton { * @extends {PopperButton} */ get defaults() { - const obj = Object.assign({}, super.defaults, { templates: { main: getTemplate(), @@ -231,7 +230,6 @@ function getAction(type) { const self = this; return function (event) { - const callback = self.getOption(`actions.${type}`); if (typeOf(callback) !== "function") { return; @@ -248,7 +246,6 @@ function getAction(type) { * @fires Monster.Components.Form.PopperButton#monster-confirmed */ function initEventhandler() { - this[cancelButtonElementSymbol].setOption( "clickEventType", this.getOption("clickEventType", ["click"]), diff --git a/source/components/form/form.mjs b/source/components/form/form.mjs index 6d02a6dd4073db5e5c8b845f0a2026f3dbf1be32..171ded496f31ea0d935d9d2ec0274ddacd9be6e3 100644 --- a/source/components/form/form.mjs +++ b/source/components/form/form.mjs @@ -201,7 +201,6 @@ class Form extends CustomElement { * @throws {Error} undefined datasource */ refresh() { - try { this.setAttribute(ATTRIBUTE_DISABLED, ""); const datasource = this.getOption("datasource"); @@ -332,7 +331,6 @@ class Form extends CustomElement { * @private */ function initUpdater() { - if (!this.shadowRoot) { throw new Error("no shadow-root is defined"); } @@ -371,7 +369,6 @@ function initUpdater() { * @private */ function initDatasource() { - if (!this.shadowRoot) { throw new Error("no shadow-root is defined"); } @@ -406,7 +403,6 @@ function initDatasource() { * @param elements */ function initWriteActions(elements) { - elements.forEach((element) => { if (element instanceof HTMLElement) { element.addEventListener("click", () => { @@ -438,7 +434,6 @@ function initWriteActions(elements) { } function runWriteCallback(button) { - if (typeof this.reportValidity === "function") { if (this.reportValidity() === false) { if ( @@ -570,7 +565,6 @@ function initObserver() { * @return {Monster.Components.Form.Form} */ function initControlReferences() { - if (!this.shadowRoot) { throw new Error("no shadow-root is defined"); } diff --git a/source/components/form/message-state-button.mjs b/source/components/form/message-state-button.mjs index 4ed1aded9558762c203848f5324bf3d226e9cd0f..a56da55f8e8473f0f18a02e752487b354cde1ca7 100644 --- a/source/components/form/message-state-button.mjs +++ b/source/components/form/message-state-button.mjs @@ -331,7 +331,6 @@ class MessageStateButton extends Popper { } function initEventHandlerByMode(mode) { - switch (mode) { case "manual": this[buttonElementSymbol].setOption("actions.click", (e) => { diff --git a/source/components/form/popper-button.mjs b/source/components/form/popper-button.mjs index e4aa440e56bdb35434fb548b97ae9c75d647e369..418ade17099abe6f927628b8ffe8714943d6f722 100644 --- a/source/components/form/popper-button.mjs +++ b/source/components/form/popper-button.mjs @@ -143,7 +143,6 @@ class PopperButton extends Popper { * @extends {Button.defaults} */ get defaults() { - return Object.assign({}, super.defaults, { templates: { main: getTemplate(), @@ -325,7 +324,6 @@ class PopperButton extends Popper { * @return {initEventhandler} */ function initEventhandler() { - this[closeEventHandler] = (event) => { const path = event.composedPath(); @@ -344,7 +342,6 @@ function initEventhandler() { * @private */ function attachResizeObserver() { - // against flickering this[resizeObserverSymbol] = new ResizeObserver(() => { if (this[timerCallbackSymbol] instanceof DeadMansSwitch) { @@ -374,7 +371,6 @@ function disconnectResizeObserver() { * @private */ function updatePopper() { - if (this[popperElementSymbol].style.display !== STYLE_DISPLAY_MODE_BLOCK) { return; } diff --git a/source/components/form/popper.mjs b/source/components/form/popper.mjs index deefc254c61fcf8f1e0ca1680778d3154ad75480..5af8acaad422a0be3f9f609bc97a72e86b5b758c 100644 --- a/source/components/form/popper.mjs +++ b/source/components/form/popper.mjs @@ -253,7 +253,6 @@ class Popper extends CustomControl { * @return {Monster.Components.Form.Popper} */ function initEventhandler() { - this[closeEventHandler] = (event) => { const path = event.composedPath(); @@ -288,7 +287,6 @@ function initEventhandler() { } function initEventHandlerByMode(mode) { - switch (mode) { case "manual": break; @@ -346,7 +344,6 @@ function initEventHandlerByMode(mode) { * @private */ function attachResizeObserver() { - // against flickering this[resizeObserverSymbol] = new ResizeObserver((entries) => { if (this[timerCallbackSymbol] instanceof DeadMansSwitch) { @@ -428,7 +425,6 @@ function show() { * @private */ function updatePopper() { - if (this[popperElementSymbol].style.display !== STYLE_DISPLAY_MODE_BLOCK) { return; } diff --git a/source/components/form/reload.mjs b/source/components/form/reload.mjs index 49a769415ea9436fcf4bb28a2c1272174be00709..d4af02a9f3b1e0b48d5be3ecf984de06ee20c1ec 100644 --- a/source/components/form/reload.mjs +++ b/source/components/form/reload.mjs @@ -260,7 +260,6 @@ function initOptionsFromArguments() { * @fires Monster.Components.Form.event:monster-fetched */ function initIntersectionObserver() { - if (this[intersectionObserverWasInitialized] === true) { return; } @@ -311,7 +310,6 @@ function initIntersectionObserver() { * @return {Promise} */ function loadContent() { - const url = this.getOption("url", undefined); if (!isString(url) || url === "") { throw new Error("missing url"); diff --git a/source/components/form/select.mjs b/source/components/form/select.mjs index 917a46e853af9d5e9ee47aee902dee8abeb34131..d04e3aad3dd1d794a7d731a6593c508a0ba14467 100644 --- a/source/components/form/select.mjs +++ b/source/components/form/select.mjs @@ -350,7 +350,6 @@ class Select extends CustomControl { * @throws {Error} unsupported type */ set value(value) { - const result = convertValueToSelection.call(this, value); setSelection .call(this, result.selection) @@ -609,7 +608,6 @@ class Select extends CustomControl { * @return {Promise} */ fetch(url) { - if (url instanceof URL) { url = url.toString(); } @@ -677,7 +675,6 @@ class Select extends CustomControl { * @throws {Error} missing label configuration */ importOptions(data) { - const mappingOptions = this.getOption("mapping", {}); const selector = mappingOptions?.["selector"]; const labelTemplate = mappingOptions?.["labelTemplate"]; @@ -793,7 +790,6 @@ function initOptionsFromArguments() { * @private */ function attachResizeObserver() { - // against flickering this[resizeObserverSymbol] = new ResizeObserver((entries) => { if (this[timerCallbackSymbol] instanceof DeadMansSwitch) { @@ -849,7 +845,6 @@ function getSummaryTemplate() { * @private */ function parseSlotsToOptions() { - let options = this.getOption("options"); if (!isIterable(options)) { options = []; @@ -950,7 +945,6 @@ function buildSelectionLabel(value) { * @throws {Error} no value found */ function getSelectionLabel(value) { - const callback = this.getOption("formatter.selection"); if (isFunction(callback)) { const label = callback.call(this, value); @@ -969,7 +963,6 @@ function getSelectionLabel(value) { * @param {Event} event */ function handleToggleKeyboardEvents(event) { - switch (event?.["code"]) { case "Escape": toggle.call(this); @@ -1008,7 +1001,6 @@ function initOptionObserver() { } function getDefaultTranslation() { - const translation = new Translations("en").assignTranslations( this.getOption("labels", {}), ); @@ -1026,7 +1018,6 @@ function getDefaultTranslation() { * @returns {string|*} */ function setSummaryAndControlText() { - const translations = getDefaultTranslation.call(this); const selections = this.getOption("selection"); @@ -1092,7 +1083,6 @@ function getOptionElements() { * @private */ function calcAndSetOptionsDimension() { - const options = getOptionElements.call(this); const container = this[optionsElementSymbol]; if (!(container instanceof HTMLElement && options instanceof NodeList)) { @@ -1169,7 +1159,6 @@ function calcAndSetOptionsDimension() { * @throws {Error} no shadow-root is defined */ function activateCurrentOption(direction) { - if (!this.shadowRoot) { throw new Error("no shadow-root is defined"); } @@ -1238,7 +1227,6 @@ function activateCurrentOption(direction) { * @private */ function filterOptions() { - new Processing(() => { let filterValue; @@ -1286,7 +1274,6 @@ function filterOptions() { * @param {Event} event */ function handleFilterKeyboardEvents(event) { - const shiftKey = event?.["shiftKey"]; switch (event?.["code"]) { @@ -1323,7 +1310,6 @@ function handleFilterKeyboardEvents(event) { * @private */ function filterFromRemote() { - if (!(this[inlineFilterElementSymbol] instanceof HTMLElement)) { return; } @@ -1363,7 +1349,6 @@ function filterFromRemote() { * @private */ function handleOptionKeyboardEvents(event) { - const shiftKey = event?.["shiftKey"]; switch (event?.["code"]) { @@ -1410,7 +1395,6 @@ function handleOptionKeyboardEvents(event) { * @returns {string} */ function getFilterMode() { - switch (this.getOption("filter.mode")) { case FILTER_MODE_OPTIONS: return FILTER_MODE_OPTIONS; @@ -1425,7 +1409,6 @@ function getFilterMode() { * @private */ function blurFilter() { - if (!(this[inlineFilterElementSymbol] instanceof HTMLElement)) { return; } @@ -1446,7 +1429,6 @@ function blurFilter() { * @param focusOptions */ function focusPopperFilter(focusOptions) { - this[popperFilterContainerElementSymbol].classList.remove("d-none"); this[popperFilterElementSymbol].classList.add("active"); this[inlineFilterElementSymbol].classList.remove("active"); @@ -1477,7 +1459,6 @@ function focusPopperFilter(focusOptions) { * @param focusOptions */ function focusInlineFilter(focusOptions) { - const options = this.getOption("options"); if ( (!isArray(options) || options.length === 0) && @@ -1505,7 +1486,6 @@ function focusInlineFilter(focusOptions) { * @private */ function focusFilter(focusOptions) { - if (getFilterMode.call(this) === FILTER_MODE_DISABLED) { this[popperFilterContainerElementSymbol].classList.add("d-none"); this[inlineFilterElementSymbol].classList.add("d-none"); @@ -1526,7 +1506,6 @@ function focusFilter(focusOptions) { * @throws {Error} unsupported type */ function gatherState() { - const type = this.getOption("type"); if (["radio", "checkbox"].indexOf(type) === -1) { throw new Error("unsupported type"); @@ -1563,7 +1542,6 @@ function gatherState() { * @throws {Error} unsupported type */ function clearSelection() { - const type = this.getOption("type"); if (["radio", "checkbox"].indexOf(type) === -1) { throw new Error("unsupported type"); @@ -1585,7 +1563,6 @@ function clearSelection() { * @private */ function areOptionsAvailableAndInit() { - // prevent multiple calls if (this[areOptionsAvailableAndInitSymbol] === undefined) { this[areOptionsAvailableAndInitSymbol] = 0; @@ -1676,7 +1653,6 @@ function areOptionsAvailableAndInit() { * @throws {Error} no shadow-root is defined */ function checkOptionState() { - if (!this.shadowRoot) { throw new Error("no shadow-root is defined"); } @@ -1752,7 +1728,6 @@ function convertValueToSelection(value) { * @return {string} */ function convertSelectionToValue(selection) { - const value = []; if (isArray(selection)) { @@ -1778,7 +1753,6 @@ function convertSelectionToValue(selection) { * @throws {Error} no shadow-root is defined */ function setSelection(selection) { - if (isString(selection)) { const result = convertValueToSelection.call(this, selection); selection = result?.selection; @@ -1837,7 +1811,6 @@ function setSelection(selection) { * @throws {TypeError} unsupported response */ function fetchData(url) { - if (!url) url = this.getOption("url"); if (!url) return Promise.resolve(); @@ -1872,7 +1845,6 @@ function fetchData(url) { * @private */ function hide() { - this[popperElementSymbol].style.display = "none"; setStatusOrRemoveBadges.call(this, "status"); removeAttributeToken(this[controlElementSymbol], "class", "open"); @@ -1882,7 +1854,6 @@ function hide() { * @private */ function show() { - if (this.getOption("disabled", undefined) === true) { return; } @@ -2178,7 +2149,6 @@ function setStatusOrRemoveBadges(suggestion) { * @throws {Error} no shadow-root is defined */ function initControlReferences() { - if (!this.shadowRoot) { throw new Error("no shadow-root is defined"); } @@ -2218,7 +2188,6 @@ function initControlReferences() { * @private */ function updatePopper() { - if (this[popperElementSymbol].style.display !== STYLE_DISPLAY_MODE_BLOCK) { return; } diff --git a/source/components/form/tabs.mjs b/source/components/form/tabs.mjs index 8258a67fe76d28c27476153b743025b8a8707c77..a6ac26529d473fcceb11f9f3d2c8b70c54dd985f 100644 --- a/source/components/form/tabs.mjs +++ b/source/components/form/tabs.mjs @@ -313,7 +313,6 @@ class Tabs extends CustomElement { * @private */ function initPopperSwitch() { - const nodes = getSlottedElements.call(this, `[${ATTRIBUTE_ROLE}="switch"]`); // null ↦ only unnamed slots let switchButton; if (nodes.size === 0) { @@ -670,7 +669,6 @@ function attachTabMutationObserver(observedNode) { * @throws {Error} no shadow-root is defined */ function initControlReferences() { - if (!this.shadowRoot) { throw new Error("no shadow-root is defined"); } @@ -696,7 +694,6 @@ function initControlReferences() { * */ function initTabButtons() { - if (!this.shadowRoot) { throw new Error("no shadow-root is defined"); } @@ -787,7 +784,6 @@ function initTabButtons() { } function checkAndRearrangeButtons() { - if (this[dimensionsSymbol].getVia("data.calculated", false) !== true) { calculateNavigationButtonsDimensions.call(this); } @@ -869,7 +865,6 @@ function calcBoxWidth(node) { * @return {Object} */ function rearrangeButtons() { - const standardButtons = []; const popperButtons = []; @@ -906,7 +901,6 @@ function rearrangeButtons() { * @return {Object} */ function calculateNavigationButtonsDimensions() { - const width = this[navElementSymbol].getBoundingClientRect().width; let startEndWidth = 0; @@ -959,7 +953,6 @@ function calculateNavigationButtonsDimensions() { * @return {string} */ function getButtonLabel(node) { - let label; let setLabel = false; if (node.hasAttribute(ATTRIBUTE_BUTTON_LABEL)) { diff --git a/source/components/form/template.mjs b/source/components/form/template.mjs index 4d5bb1f6569379cdc78c5ba47d59c7d54dc0dfde..c6a7fb64f571d33e050dabd6db465096fbc77200 100644 --- a/source/components/form/template.mjs +++ b/source/components/form/template.mjs @@ -244,7 +244,6 @@ function initOptionsFromArguments() { * @fires Monster.Components.Form.event:monster-fetched */ function initIntersectionObserver() { - if (this[intersectionObserverWasInitialized] === true) { return; } @@ -291,7 +290,6 @@ function initIntersectionObserver() { * @fires Monster.Components.Form.event:monster-fetched */ function loadContent() { - if (!this.shadowRoot) { throw new Error("no shadow-root is defined"); } @@ -335,7 +333,6 @@ function loadContent() { * @return {runProcessors} */ function runProcessors() { - const processors = this.getOption("processors"); if (!isArray(processors)) return; diff --git a/source/components/form/tree-select.mjs b/source/components/form/tree-select.mjs index 47e0517b6ee926b132a0b94c806df8f3fd684a8b..8763d56ac29484e89449ba041a808a4df61a9040 100644 --- a/source/components/form/tree-select.mjs +++ b/source/components/form/tree-select.mjs @@ -152,7 +152,6 @@ class TreeSelect extends Select { * @throws {Error} map is not iterable */ importOptions(data) { - this[internalNodesSymbol] = new Map(); const mappingOptions = this.getOption("mapping", {}); @@ -215,7 +214,6 @@ class TreeSelect extends Select { * @param event */ function handleOptionKeyboardEvents(event) { - switch (event?.["code"]) { case "ArrowLeft": closeOrOpenCurrentOption.call(this, event, "close"); @@ -333,7 +331,6 @@ const openOptionEventHandler = Symbol("openOptionEventHandler"); * @throws {Error} no shadow-root is defined */ function initEventhandler() { - if (!this.shadowRoot) { throw new Error("no shadow-root is defined"); } diff --git a/source/components/form/util/popper.mjs b/source/components/form/util/popper.mjs index 9d7b29b70b494d04b71a4e6a38d90e84b82fbac3..d12c4bc74c6e4382c736567313c4db881b4c6dcf 100644 --- a/source/components/form/util/popper.mjs +++ b/source/components/form/util/popper.mjs @@ -23,7 +23,6 @@ const popperInstanceSymbol = Symbol("popperInstance"); * @param {Boolean} mode */ function setEventListenersModifiers(mode) { - const options = extend({}, this.getOption("popper")); const modifiers = options?.["modifiers"]; diff --git a/source/components/host/call-button.mjs b/source/components/host/call-button.mjs index 472067e6fb460de09631fa6c2b4a4ad3f81e6335..a7a5a08f76731cfc3c376ba918a8dfcd6fedd8c6 100644 --- a/source/components/host/call-button.mjs +++ b/source/components/host/call-button.mjs @@ -147,7 +147,6 @@ class CallButton extends CustomElement { * @return {CallButton} */ function initControlReferences() { - if (!this.shadowRoot) { throw new Error("no shadow-root is defined"); } @@ -192,7 +191,6 @@ function initOptionsFromArguments() { * @throws {Error} The option references.callableSelector must be an array */ function initEventHandler() { - const doc = getDocument(); this[callButtonElementSymbol].addEventListener("click", (event) => { diff --git a/source/components/host/collapse.mjs b/source/components/host/collapse.mjs index 65922b1b5dad646b99ac580038b857648695c1cd..48890f0166f4c494f0881365940cc41cfe9aad86 100644 --- a/source/components/host/collapse.mjs +++ b/source/components/host/collapse.mjs @@ -316,7 +316,6 @@ class Collapse extends CustomElement { } function adjustHeight() { - let height = 0; if (this[detailsContainerElementSymbol]) { @@ -345,7 +344,6 @@ function adjustHeight() { } function updateResizeObserverObservation() { - this[resizeObserverSymbol].disconnect(); const slottedNodes = getSlottedElements.call(this); @@ -364,7 +362,6 @@ function updateResizeObserverObservation() { * @private */ function initEventHandler() { - if (!this.shadowRoot) { throw new Error("no shadow-root is defined"); } @@ -374,7 +371,6 @@ function initEventHandler() { } function initSlotChangedHandler() { - this[detailsSlotElementSymbol].addEventListener("slotchange", () => { updateResizeObserverObservation.call(this); }); @@ -386,7 +382,6 @@ function initSlotChangedHandler() { * @throws {Error} no shadow-root is defined */ function initControlReferences() { - if (!this.shadowRoot) { throw new Error("no shadow-root is defined"); } @@ -418,7 +413,6 @@ function getConfigKey() { * @private */ function updateStateConfig() { - if (!this.getOption("features.persistState")) { return; } @@ -447,7 +441,6 @@ function updateStateConfig() { * @returns {Promise} */ function initStateFromHostConfig() { - if (!this.getOption("features.persistState")) { return Promise.resolve({}); } @@ -483,7 +476,6 @@ function initStateFromHostConfig() { * @private */ function initResizeObserver() { - // against flickering this[resizeObserverSymbol] = new ResizeObserver((entries) => { if (this[timerCallbackSymbol] instanceof DeadMansSwitch) { diff --git a/source/components/host/config-manager.mjs b/source/components/host/config-manager.mjs index a401507207affb4e19604e1a66ea5a13bb9608e4..72382d553a79771e74695a9a7a46be863cc6c6be 100644 --- a/source/components/host/config-manager.mjs +++ b/source/components/host/config-manager.mjs @@ -136,7 +136,6 @@ class ConfigManager extends CustomElement { * @returns {Promise<unknown>} */ getConfig(key) { - return this.ready().then(() => { return getBlob.call(this, key); }); @@ -239,7 +238,6 @@ function getObjectStore(mode) { * @returns {Promise<unknown>} */ function clearObjectStore() { - const store = getObjectStore.call(this, "readwrite"); return new Promise((resolve, reject) => { diff --git a/source/components/host/details.mjs b/source/components/host/details.mjs index a8faf70b426e0dd767e82b8a51ceae60547b91d8..a3153810db3c6fb41f743c732ab9939d7adaec00 100644 --- a/source/components/host/details.mjs +++ b/source/components/host/details.mjs @@ -168,7 +168,6 @@ class Details extends Collapse { * @throws {Error} no shadow-root is defined */ function initControlReferences() { - if (!this.shadowRoot) { throw new Error("no shadow-root is defined"); } @@ -182,7 +181,6 @@ function initControlReferences() { * @private */ function initEventHandler() { - if (!this.shadowRoot) { throw new Error("no shadow-root is defined"); } @@ -204,7 +202,6 @@ function initEventHandler() { * @return {string} */ function initButtonLabel() { - let label; const setLabel = false; if (this.hasAttribute(ATTRIBUTE_BUTTON_LABEL)) { diff --git a/source/components/host/host.mjs b/source/components/host/host.mjs index 0e15d38045f96306d27718af3f9be46316b293a8..50d5645ab9c30d7130220645d13984da44905544 100644 --- a/source/components/host/host.mjs +++ b/source/components/host/host.mjs @@ -180,7 +180,6 @@ class Host extends CustomElement { * @fires Monster.Components.Host.Host#monster-host-disconnected */ disconnectedCallback() { - super.disconnectedCallback(); document.documentElement.style.overflowY = ""; @@ -213,7 +212,6 @@ class Host extends CustomElement { * @return {Monster.Components.Host.Host} */ [assembleMethodSymbol]() { - this[promisesSymbol] = []; this[promisesSymbol].push(windowReady); @@ -254,7 +252,6 @@ class Host extends CustomElement { * @return {Promise} */ onReady() { - if (isIterable(this[promisesSymbol]) === false) { this[promisesSymbol] = []; } @@ -372,7 +369,6 @@ class Host extends CustomElement { * @throws {Error} no shadow-root is defined */ function initControlReferences() { - if (!this.shadowRoot) { throw new Error("no shadow-root is defined"); } @@ -385,7 +381,6 @@ function initControlReferences() { } function initTranslations() { - if (isIterable(this[promisesSymbol]) === false) { this[promisesSymbol] = []; } diff --git a/source/components/host/overlay.mjs b/source/components/host/overlay.mjs index 781df7877754da6f0d2c1841ccd4994624ce56b1..5f7bf0391abf0d4bd406f66d092429ab9a179152 100644 --- a/source/components/host/overlay.mjs +++ b/source/components/host/overlay.mjs @@ -251,7 +251,6 @@ class Overlay extends CustomElement { * @throws {Error} no shadow-root is defined */ function initControlReferences() { - if (!this.shadowRoot) { throw new Error("no shadow-root is defined"); } @@ -269,7 +268,6 @@ function initControlReferences() { * @private */ function initEventHandler() { - /** * @param {Event} event */ diff --git a/source/components/host/viewer.mjs b/source/components/host/viewer.mjs index 09441a116726dace2c0874bbdca5dacb8d132959..8581aef063f742eb77929fed76dbe7c9c962d3ef 100644 --- a/source/components/host/viewer.mjs +++ b/source/components/host/viewer.mjs @@ -280,7 +280,6 @@ function blobToText(blob) { * @throws {Error} no shadow-root is defined */ function initControlReferences() { - if (!this.shadowRoot) { throw new Error("no shadow-root is defined"); } diff --git a/source/components/notify/message.mjs b/source/components/notify/message.mjs index 24071f94af768e87b068fae087da1cac67a0c40d..004c29b1ac38441e072e280116038c2a329bb446 100644 --- a/source/components/notify/message.mjs +++ b/source/components/notify/message.mjs @@ -218,7 +218,6 @@ function startFadeout() { } function removeSelf() { - stopFadeout(); this.classList.add("fadeout"); @@ -267,7 +266,6 @@ function initOptionsFromArguments() { * @throws {Error} no shadow-root is defined */ function initControlReferences() { - if (!this.shadowRoot) { throw new Error("no shadow-root is defined"); } @@ -284,7 +282,6 @@ function initControlReferences() { * @private */ function initEventhandler() { - /** * @param {Event} event */ diff --git a/source/components/notify/notify.mjs b/source/components/notify/notify.mjs index adcb4edb5c41eb92062b65ae3e68f7ee2e7be866..48a335037020a07b28807108325fef19b9e36d7a 100644 --- a/source/components/notify/notify.mjs +++ b/source/components/notify/notify.mjs @@ -157,7 +157,6 @@ class Notify extends CustomElement { * @return {Monster.Components.Notify.Notify} */ push(message) { - let messageElement = message; if (!(message instanceof Message)) { const text = validateString(message); @@ -205,7 +204,6 @@ function initOptionsFromArguments() { * @throws {Error} no shadow-root is defined */ function initControlReferences() { - if (!this.shadowRoot) { throw new Error("no shadow-root is defined"); } diff --git a/source/components/state/log.mjs b/source/components/state/log.mjs index 87017e82ef3b26182688d138ac45e6e8b406cd76..33038cb33d56c952af1be97c9af507796fe68fdc 100644 --- a/source/components/state/log.mjs +++ b/source/components/state/log.mjs @@ -122,14 +122,12 @@ class Log extends CustomElement { * @return {Log} */ clear() { - this[logElementSymbol].innerHTML = ""; this[emptyStateElementSymbol].style.display = "block"; return this; } addEntry(entry) { - validateInstance(entry, Entry); const entries = this.getOption("entries"); @@ -148,7 +146,6 @@ class Log extends CustomElement { * @return {Log} */ addMessage(message, date) { - if (!date) { date = new Date(); } @@ -185,7 +182,6 @@ class Log extends CustomElement { * @throws {Error} no shadow-root is defined */ function initControlReferences() { - if (!this.shadowRoot) { throw new Error("no shadow-root is defined"); } @@ -202,7 +198,6 @@ function initControlReferences() { * @private */ function initEventHandler() { - if (!this.shadowRoot) { throw new Error("no shadow-root is defined"); } diff --git a/source/components/tree-menu/tree-menu.mjs b/source/components/tree-menu/tree-menu.mjs index aba16acc9d3c7d6e3c42b0b1834bfdac64e526f1..96c5e36b2d4acf423f6e4d1269b57cd77cace66a 100644 --- a/source/components/tree-menu/tree-menu.mjs +++ b/source/components/tree-menu/tree-menu.mjs @@ -231,7 +231,6 @@ class TreeMenu extends CustomElement { * @private */ function initEventhandler() { - switchToConfig.call(this); this[openEntryEventHandlerSymbol] = (event) => { @@ -331,7 +330,6 @@ function initObserver() {} * @private */ function importEntries(data) { - this[internalNodesSymbol] = new Map(); const mappingOptions = this.getOption("mapping", {}); @@ -441,7 +439,6 @@ function formatKeyLabel(node) { * @return {Monster.Components.TreeMenu.Form} */ function initControlReferences() { - if (!this.shadowRoot) { throw new Error("no shadow-root is defined"); } @@ -474,7 +471,6 @@ function initOptionsFromArguments() { } function switchToConfig() { - if (!this.shadowRoot) { throw new Error("no shadow-root is defined"); } diff --git a/source/util/clone.mjs b/source/util/clone.mjs index cac83a9086f6159b64c8477e473c54ad6fcd5e67..312ae1a7c8619dbc6021572c3d8078c46774bcc7 100644 --- a/source/util/clone.mjs +++ b/source/util/clone.mjs @@ -48,7 +48,7 @@ function clone(obj) { // Handle Array if (isArray(obj)) { const copy = []; - for (var i = 0, len = obj.length; i < len; i++) { + for (let i = 0, len = obj.length; i < len; i++) { copy[i] = clone(obj[i]); }