@schukai/monster 3.23.0 → 3.26.0
Sign up to get free protection for your applications and to get access to all the features.
package/package.json
CHANGED
@@ -8,6 +8,7 @@
|
|
8
8
|
import {internalSymbol} from "../constants.mjs";
|
9
9
|
import {extend} from "../data/extend.mjs";
|
10
10
|
import {Pathfinder} from "../data/pathfinder.mjs";
|
11
|
+
import {Formatter} from "../text/formatter.mjs";
|
11
12
|
|
12
13
|
import {parseDataURL} from "../types/dataurl.mjs";
|
13
14
|
import {getGlobalObject} from "../types/global.mjs";
|
@@ -946,6 +947,11 @@ function initShadowRoot() {
|
|
946
947
|
return this;
|
947
948
|
}
|
948
949
|
|
950
|
+
const mapping = this.getOption("templateMapping", {});
|
951
|
+
if (isObject(mapping)) {
|
952
|
+
html = new Formatter(mapping).format(html);
|
953
|
+
}
|
954
|
+
|
949
955
|
this.shadowRoot.innerHTML = html;
|
950
956
|
return this;
|
951
957
|
}
|
@@ -963,5 +969,14 @@ function initShadowRoot() {
|
|
963
969
|
*/
|
964
970
|
function registerCustomElement(element) {
|
965
971
|
validateFunction(element);
|
966
|
-
getGlobalObject("customElements")
|
972
|
+
const customElements = getGlobalObject("customElements")
|
973
|
+
if (customElements === undefined) {
|
974
|
+
throw new Error("customElements is not supported.");
|
975
|
+
}
|
976
|
+
|
977
|
+
if (customElements.get(element.getTag()) !== undefined) {
|
978
|
+
return;
|
979
|
+
}
|
980
|
+
|
981
|
+
customElements.define(element.getTag(), element);
|
967
982
|
}
|
package/source/types/version.mjs
CHANGED
package/test/cases/monster.mjs
CHANGED