We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e639c05 commit e429931Copy full SHA for e429931
ES3-scoped-css.js
@@ -0,0 +1,15 @@
1
+// if you are supporting Opera 9 or lower, Internet Explorer 8 or lower, or older Safari version
2
+
3
+function generate_scoped_styles(doc) {
4
+ doc = doc || document
5
+ /** @type {HTMLCollection} */
6
+ var styles = doc.getElementsByTagName("style")
7
+ for (var i = 0; i < styles.length; i++) {
8
+ if (styles[i].className != "scoped") continue
9
+ var style = styles[i]
10
+ var parent_el = style.parentElement
11
+ parent_el.id = parent_el.id || "i" + (Math.random() * 1e9 | 0) // .toString(16)
12
+ style.innerHTML = style.innerHTML.split("\\\&").join("#" + parent_el.id)
13
+ }
14
+}
15
+generate_scoped_styles()
0 commit comments