structured-fw 0.9.0 → 0.9.1
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.
|
@@ -21,7 +21,7 @@ export declare class DOMNode {
|
|
|
21
21
|
attributeMap: Record<string, DOMNodeAttribute>;
|
|
22
22
|
style: Partial<CSSStyleDeclaration>;
|
|
23
23
|
selfClosing: boolean;
|
|
24
|
-
potentialComponentChildren:
|
|
24
|
+
potentialComponentChildren: Array<DOMNode>;
|
|
25
25
|
constructor(root: DOMFragment | null, parentNode: DOMNode | null, tagName: string);
|
|
26
26
|
appendChild(node: DOMNode | string): void;
|
|
27
27
|
setAttribute(attributeName: string, attributeValue: string | true): void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { HTMLParser } from "./HTMLParser.js";
|
|
2
2
|
export const selfClosingTags = ['br', 'hr', 'input', 'img', 'link', 'meta', 'source', 'embed', 'path', 'area'];
|
|
3
|
-
export const recognizedHTMLTags = ['body', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p', 'b', 'i', 'a', 'em', 'strong', 'br', 'hr', 'abbr', '
|
|
3
|
+
export const recognizedHTMLTags = ['body', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p', 'b', 'i', 'a', 'em', 'strong', 'br', 'hr', 'abbr', 'bdi', 'bdo', 'blockquote', 'cite', 'code', 'del', 'dfn', 'ins', 'kbd', 'mark', 'pre', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'small', 'span', 'sub', 'sup', 'time', 'u', 'var', 'ul', 'ol', 'li', 'dl', 'dt', 'dd', 'img', 'area', 'map', 'object', 'param', 'table', 'tr', 'td', 'th', 'caption', 'colgroup', 'col', 'form', 'input', 'label', 'select', 'option', 'textarea', 'button', 'fieldset', 'datalist', 'iframe', 'audio', 'video', 'source', 'track', 'script', 'noscript', 'div', 'nav', 'aside', 'canvas', 'embed', 'template'];
|
|
4
4
|
export class DOMNode {
|
|
5
5
|
constructor(root, parentNode, tagName) {
|
|
6
6
|
this.parentNode = null;
|
|
@@ -8,7 +8,7 @@ export class DOMNode {
|
|
|
8
8
|
this.attributes = [];
|
|
9
9
|
this.attributeMap = {};
|
|
10
10
|
this.style = {};
|
|
11
|
-
this.potentialComponentChildren =
|
|
11
|
+
this.potentialComponentChildren = [];
|
|
12
12
|
this.root = root === null ? this : root;
|
|
13
13
|
this.isRoot = root === null;
|
|
14
14
|
this.parentNode = parentNode;
|
|
@@ -77,10 +77,7 @@ export class DOMNode {
|
|
|
77
77
|
registerPotentialComponent(node) {
|
|
78
78
|
if (this.parentNode !== null) {
|
|
79
79
|
if (this.parentNode.isRoot || this.parentNode.isPotentialComponent()) {
|
|
80
|
-
|
|
81
|
-
this.parentNode.potentialComponentChildren[node.tagName] = [];
|
|
82
|
-
}
|
|
83
|
-
this.parentNode.potentialComponentChildren[node.tagName].push(node);
|
|
80
|
+
this.parentNode.potentialComponentChildren.push(node);
|
|
84
81
|
}
|
|
85
82
|
else {
|
|
86
83
|
this.parentNode.registerPotentialComponent(node);
|
|
@@ -88,9 +85,7 @@ export class DOMNode {
|
|
|
88
85
|
}
|
|
89
86
|
}
|
|
90
87
|
components() {
|
|
91
|
-
return
|
|
92
|
-
return prev.concat(curr);
|
|
93
|
-
}, []);
|
|
88
|
+
return this.potentialComponentChildren;
|
|
94
89
|
}
|
|
95
90
|
get innerHTML() {
|
|
96
91
|
return this.children.reduce((html, child) => {
|
package/package.json
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"license": "MIT",
|
|
15
15
|
"type": "module",
|
|
16
16
|
"main": "build/index",
|
|
17
|
-
"version": "0.9.
|
|
17
|
+
"version": "0.9.1",
|
|
18
18
|
"scripts": {
|
|
19
19
|
"develop": "tsc --watch",
|
|
20
20
|
"startDev": "cd build && nodemon --watch '../app/**/*' --watch '../build/**/*' -e js,html,css index.js",
|