From d94697cf52cbec2734f879b04c029cde483e9a20 Mon Sep 17 00:00:00 2001 From: Volker Schukai <volker.schukai@schukai.com> Date: Tue, 23 Jan 2024 12:00:38 +0100 Subject: [PATCH] fix: reset config #136 --- source/dom/customelement.mjs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/source/dom/customelement.mjs b/source/dom/customelement.mjs index 6470a42d5..b8af29a64 100644 --- a/source/dom/customelement.mjs +++ b/source/dom/customelement.mjs @@ -503,9 +503,11 @@ class CustomElement extends HTMLElement { if (isString(options)) { options = parseOptionsJSON.call(this, options); } + // 2024-01-21: remove this.defaults, otherwise it will overwrite + // the current settings that have already been made. + // https://gitlab.schukai.com/oss/libraries/javascript/monster/-/issues/136 extend( this[internalSymbol].getSubject()["options"], - this.defaults, options, ); @@ -979,9 +981,12 @@ function getOptionsFromAttributes() { } /** + * Parses the given JSON data and returns the parsed object. + * * @private - * @param data - * @return {Object} + * @param {string} data The JSON data to be parsed. + * @returns {Object} The parsed object. + * @throws {error} Throws an error if the JSON data is not valid. */ function parseOptionsJSON(data) { let obj = {}; -- GitLab