@zyrab/domo 1.2.1 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/builder.js +4 -1
- package/src/children.js +0 -4
package/package.json
CHANGED
package/src/builder.js
CHANGED
|
@@ -32,9 +32,12 @@ class Builder {
|
|
|
32
32
|
|
|
33
33
|
if (cls) attrs.push(`class="${cls}"`);
|
|
34
34
|
if (css) attrs.push(`style="${css}"`);
|
|
35
|
+
const escapeHTML = (str) => String(str).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
35
36
|
|
|
36
37
|
const attrStr = attrs.concat(data).join(" ");
|
|
37
|
-
const children = this.element._child
|
|
38
|
+
const children = this.element._child
|
|
39
|
+
.map((c) => (typeof c === "string" ? escapeHTML(c) : c.build?.() || ""))
|
|
40
|
+
.join("");
|
|
38
41
|
|
|
39
42
|
return `<${tag}${attrStr ? " " + attrStr : ""}>${children}</${tag}>`;
|
|
40
43
|
}
|
package/src/children.js
CHANGED
|
@@ -10,10 +10,6 @@ class Children {
|
|
|
10
10
|
* a string for virtual children, or a Domo instance for virtual children.
|
|
11
11
|
*/
|
|
12
12
|
_handleElementInstance(element) {
|
|
13
|
-
// Check if Domo class exists (it's imported in main.domo.js for final class)
|
|
14
|
-
// To avoid circular dependency in JSDoc parsing, we'll check runtime type.
|
|
15
|
-
// For JSDoc type checking, we assume Domo is available in the context of main.domo.js.
|
|
16
|
-
// @ts-ignore - Ignore potential 'Domo is not defined' for JSDoc tool
|
|
17
13
|
if (element instanceof DomoClass) return element.build();
|
|
18
14
|
|
|
19
15
|
if (element instanceof DocumentFragment) return element;
|