@@ -14,18 +14,22 @@ const injectBindFnContent
14
14
= 'instance.addCEChildStyle = this._addChildStyles.bind(this);\n'
15
15
+ ' instance.removeCEChildStyle = this._removeChildStyles.bind(this);\n '
16
16
17
- const injectAddAndRemoveStyle = ' _addChildStyles(styles, instance) {\n'
17
+ const injectAddAndRemoveStyle = '_addChildStyles(styles, instance) {\n'
18
18
+ ' if (styles) {\n'
19
19
+ ' const styleContent = styles.join();\n'
20
- + ' let cecStyle = /* @__PURE__ */ new Set();\n'
20
+ // eslint-disable-next-line no-template-curly-in-string
21
+ + ' const ceKey = `__${this._instance.uid}`;\n'
22
+ + ' let ceKeySet = /* @__PURE__ */ new Set();\n'
21
23
+ ' if (ceChildStyleMap.has(styleContent)) {\n'
22
- + ' cecStyle = ceChildStyleMap.get(styleContent);\n'
23
- + ' cecStyle.add(instance.uid);\n'
24
- + ' ceChildStyleMap.set(styleContent, cecStyle);\n'
25
- + ' return;\n'
24
+ + ' ceKeySet = ceChildStyleMap.get(styleContent);\n'
25
+ + ' if (ceKeySet.has(ceKey)) {\n'
26
+ + ' ceKeySet.add(ceKey);\n'
27
+ + ' ceChildStyleMap.set(styleContent, ceKeySet);\n'
28
+ + ' return;\n'
29
+ + ' }\n'
26
30
+ ' }\n'
27
- + ' cecStyle .add(instance.uid );\n'
28
- + ' ceChildStyleMap.set(styleContent, cecStyle );\n'
31
+ + ' ceKeySet .add(ceKey );\n'
32
+ + ' ceChildStyleMap.set(styleContent, ceKeySet );\n'
29
33
// eslint-disable-next-line no-template-curly-in-string
30
34
+ ' const ceStyleId = `data-v-ce-${instance.uid}`;\n'
31
35
+ ' styles.forEach((css, index) => {\n'
@@ -52,8 +56,10 @@ const injectAddAndRemoveStyle = ' _addChildStyles(styles, instance) {\n'
52
56
+ ' const styleContent = styles.join();\n'
53
57
+ ' let cecStyle = /* @__PURE__ */ new Set();\n'
54
58
+ ' if (ceChildStyleMap.has(styleContent)) {\n'
59
+ // eslint-disable-next-line no-template-curly-in-string
60
+ + ' const ceKey = `__${this._instance.uid}`;\n'
55
61
+ ' cecStyle = ceChildStyleMap.get(styleContent);\n'
56
- + ' cecStyle.delete(uid );\n'
62
+ + ' cecStyle.delete(ceKey );\n'
57
63
+ ' if (cecStyle.size === 0) {\n'
58
64
// eslint-disable-next-line no-template-curly-in-string
59
65
+ ' const sList = this.shadowRoot.querySelectorAll(`[data-v-ce-${uid}]`);\n'
0 commit comments