cotomy 0.4.5 → 0.4.6
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/dist/browser/cotomy.js +3 -3
- package/dist/browser/cotomy.js.map +1 -1
- package/dist/browser/cotomy.min.js +1 -1
- package/dist/browser/cotomy.min.js.map +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/view.js +3 -3
- package/dist/esm/view.js.map +1 -1
- package/package.json +1 -1
package/dist/browser/cotomy.js
CHANGED
|
@@ -1008,9 +1008,9 @@ class CotomyElement {
|
|
|
1008
1008
|
const cssid = this.scopedCssElementId;
|
|
1009
1009
|
CotomyElement.find(`#${cssid}`).forEach(e => e.remove());
|
|
1010
1010
|
const element = document.createElement("style");
|
|
1011
|
-
const
|
|
1012
|
-
const normalizedCss =
|
|
1013
|
-
const writeCss = normalizedCss.replace(/\[
|
|
1011
|
+
const hasRoot = /\[root\]/.test(css);
|
|
1012
|
+
const normalizedCss = hasRoot ? css : `[root] ${css}`;
|
|
1013
|
+
const writeCss = normalizedCss.replace(/\[root\]/g, `[data-cotomy-scopeid="${this.scopeId}"]`);
|
|
1014
1014
|
const node = document.createTextNode(writeCss);
|
|
1015
1015
|
element.appendChild(node);
|
|
1016
1016
|
element.id = cssid;
|