From 012e2e8afaf63d0d2638956c1cef8b46bdedec9f Mon Sep 17 00:00:00 2001 From: chris Date: Fri, 11 Oct 2024 16:24:09 +0200 Subject: [PATCH] IMPRO,REFA: Minor changes removing logs added span element to builder typos added docu --- src/builder.js | 6 ++++++ src/commonEvents.js | 4 ++-- src/component.js | 1 - src/context.js | 7 +++++-- src/modifier.js | 4 ++-- 5 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/builder.js b/src/builder.js index 9302e39..a4f83fc 100644 --- a/src/builder.js +++ b/src/builder.js @@ -48,6 +48,12 @@ const builder = { * @returns {Component} */ div: function (attr = {}) { return builder.genTag("div", attr); }, + /** + * + * @param {Map} attr + * @returns {Component} + */ + span: function (attr = {}) { return builder.genTag("span", attr); }, /** * * @param {Map} attr diff --git a/src/commonEvents.js b/src/commonEvents.js index cac4782..8cedfe0 100644 --- a/src/commonEvents.js +++ b/src/commonEvents.js @@ -2,7 +2,7 @@ * Enum to access common events */ const CommonEvents = Object.freeze({ - ONCLICK: "onClick", - ONCHANGE: "onChange" + ONCLICK: "onclick", + ONCHANGE: "onchange" }) diff --git a/src/component.js b/src/component.js index e264ddc..f78c82e 100644 --- a/src/component.js +++ b/src/component.js @@ -131,7 +131,6 @@ class Component { * @returns {Component} this component object */ childContext(component) { - console.log(arguments, arguments.length > 1) if (arguments.length > 1) { for (let i = 0; i < arguments.length; i++) { this.childContext(arguments[i]); diff --git a/src/context.js b/src/context.js index 7cc0317..2ec6d50 100644 --- a/src/context.js +++ b/src/context.js @@ -21,7 +21,7 @@ class PageBuilder { */ registerFunction(name, fun) { if (!this.#functionNames.includes(name)) { - this.#functions.innerText += `const ${name} = ${fun}`; + this.#functions.innerText += `const ${name} = ${fun};`; this.#functionNames.push(name); } } @@ -51,9 +51,12 @@ class PageBuilder { head.appendChild(this.#functions) head.appendChild(this.#cssClasses) - console.log(this.#functionNames) } + /** + * + * @param {number} relaunchSeconds timeinterval for page to reload (changes) + */ inDev(relaunchSeconds = 20) { let head = document.querySelector("head"); let meta = document.createElement("meta"); diff --git a/src/modifier.js b/src/modifier.js index 2576427..2e0e0b7 100644 --- a/src/modifier.js +++ b/src/modifier.js @@ -79,7 +79,7 @@ class Modifier { * @returns {Modifier} this modifier object */ margin(siding) { - this._modifications["margin"] = siding.getOrderedValues(); + this._modifications["margin"] = siding.getOrderedValues().join(' '); return this; } @@ -203,7 +203,7 @@ class Modifier { if (borderWidth === -1) { return new BorderChain(this); } else { - return new BorderChain(this).all(borderWidth); + return new BorderChain(this).width(borderWidth); } }