@domql/render 2.5.51 → 2.5.75
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/append.js +3 -1
- package/cache.js +7 -6
- package/dist/cjs/append.js +3 -1
- package/dist/cjs/cache.js +9 -6
- package/package.json +2 -2
package/append.js
CHANGED
|
@@ -13,8 +13,10 @@ export const insertNodeAfter = (node, siblingNode, parentNode) => {
|
|
|
13
13
|
const parent = (parentNode || siblingNode.parentNode)
|
|
14
14
|
if (siblingNode.nextSibling) {
|
|
15
15
|
parent && parent.insertBefore(node, siblingNode.nextSibling)
|
|
16
|
+
} else if (siblingNode?.insertAdjacentElement) {
|
|
17
|
+
siblingNode.insertAdjacentElement('afterend', node)
|
|
16
18
|
} else {
|
|
17
|
-
|
|
19
|
+
parent.insertBefore(node, siblingNode)
|
|
18
20
|
}
|
|
19
21
|
}
|
|
20
22
|
|
package/cache.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
3
|
import { report } from '@domql/report'
|
|
4
|
-
import {
|
|
4
|
+
import { canRenderTag } from '@domql/event'
|
|
5
5
|
import { exec, isObject, isString, isValidHtmlTag } from '@domql/utils'
|
|
6
6
|
|
|
7
7
|
const cache = {}
|
|
@@ -32,11 +32,12 @@ export const detectTag = element => {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
if (isString(tag)) {
|
|
35
|
-
|
|
36
|
-
if (tagExists) return tag
|
|
35
|
+
if (isValidHtmlTag(tag)) return tag
|
|
37
36
|
} else {
|
|
38
|
-
|
|
39
|
-
if (
|
|
37
|
+
let keyAsTag = key.toLowerCase()
|
|
38
|
+
if (keyAsTag.includes('.')) keyAsTag = keyAsTag.split('.')[0]
|
|
39
|
+
if (keyAsTag.includes('_')) keyAsTag = keyAsTag.split('_')[0]
|
|
40
|
+
if (isValidHtmlTag(keyAsTag)) return keyAsTag
|
|
40
41
|
}
|
|
41
42
|
|
|
42
43
|
return 'div'
|
|
@@ -45,7 +46,7 @@ export const detectTag = element => {
|
|
|
45
46
|
export const cacheNode = (element) => {
|
|
46
47
|
const tag = element.tag = detectTag(element)
|
|
47
48
|
|
|
48
|
-
if (!
|
|
49
|
+
if (!canRenderTag(tag)) {
|
|
49
50
|
return report('HTMLInvalidTag', element.tag, element)
|
|
50
51
|
}
|
|
51
52
|
|
package/dist/cjs/append.js
CHANGED
|
@@ -32,8 +32,10 @@ const insertNodeAfter = (node, siblingNode, parentNode) => {
|
|
|
32
32
|
const parent = parentNode || siblingNode.parentNode;
|
|
33
33
|
if (siblingNode.nextSibling) {
|
|
34
34
|
parent && parent.insertBefore(node, siblingNode.nextSibling);
|
|
35
|
+
} else if (siblingNode == null ? void 0 : siblingNode.insertAdjacentElement) {
|
|
36
|
+
siblingNode.insertAdjacentElement("afterend", node);
|
|
35
37
|
} else {
|
|
36
|
-
|
|
38
|
+
parent.insertBefore(node, siblingNode);
|
|
37
39
|
}
|
|
38
40
|
};
|
|
39
41
|
const insertNodeBefore = (node, siblingNode, parentNode) => {
|
package/dist/cjs/cache.js
CHANGED
|
@@ -53,19 +53,22 @@ const detectTag = (element) => {
|
|
|
53
53
|
return props.tag;
|
|
54
54
|
}
|
|
55
55
|
if ((0, import_utils.isString)(tag)) {
|
|
56
|
-
|
|
57
|
-
if (tagExists)
|
|
56
|
+
if ((0, import_utils.isValidHtmlTag)(tag))
|
|
58
57
|
return tag;
|
|
59
58
|
} else {
|
|
60
|
-
|
|
61
|
-
if (
|
|
62
|
-
|
|
59
|
+
let keyAsTag = key.toLowerCase();
|
|
60
|
+
if (keyAsTag.includes("."))
|
|
61
|
+
keyAsTag = keyAsTag.split(".")[0];
|
|
62
|
+
if (keyAsTag.includes("_"))
|
|
63
|
+
keyAsTag = keyAsTag.split("_")[0];
|
|
64
|
+
if ((0, import_utils.isValidHtmlTag)(keyAsTag))
|
|
65
|
+
return keyAsTag;
|
|
63
66
|
}
|
|
64
67
|
return "div";
|
|
65
68
|
};
|
|
66
69
|
const cacheNode = (element) => {
|
|
67
70
|
const tag = element.tag = detectTag(element);
|
|
68
|
-
if (!(0, import_event.
|
|
71
|
+
if (!(0, import_event.canRenderTag)(tag)) {
|
|
69
72
|
return (0, import_report.report)("HTMLInvalidTag", element.tag, element);
|
|
70
73
|
}
|
|
71
74
|
let cachedTag = cache[tag];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@domql/render",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.75",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "index.js",
|
|
@@ -28,5 +28,5 @@
|
|
|
28
28
|
"build": "yarn build:cjs",
|
|
29
29
|
"prepublish": "rimraf -I dist && yarn build && yarn copy:package:cjs"
|
|
30
30
|
},
|
|
31
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "aed026de97492c8c0e4da1f47cb027bc6db63362"
|
|
32
32
|
}
|