Forráskód Böngészése

HUE-7 [importer] Add CSSStyleSheet.prototype.addRule polyfill

Enrico Berti 8 éve
szülő
commit
cecd7a5

+ 7 - 0
desktop/core/src/desktop/static/desktop/js/hue.utils.js

@@ -108,6 +108,13 @@ if (!String.prototype.includes) {
   };
 }
 
+if (!('addRule' in CSSStyleSheet.prototype)) {
+  CSSStyleSheet.prototype.addRule = function (selector, rule, idx) {
+    return this.insertRule(selector + "{" + rule + "}", idx || 0);
+  }
+}
+
+
 /*
  * Add utility methods to the HUE object
 */