Explorar o código

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

Enrico Berti %!s(int64=8) %!d(string=hai) anos
pai
achega
cecd7a5
Modificáronse 1 ficheiros con 7 adicións e 0 borrados
  1. 7 0
      desktop/core/src/desktop/static/desktop/js/hue.utils.js

+ 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
 */