From 5b74b4d6fe68e81d76ce8743c017201212f0d7aa Mon Sep 17 00:00:00 2001 From: Brian Federle Date: Tue, 7 May 2013 15:44:28 -0700 Subject: [PATCH] UI plugin API: Support IE-compatible CSS loading If browser is IE < 9, use document.createStyleSheet to properly load plugin's CSS dynamically. --- ui/scripts/plugins.js | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/ui/scripts/plugins.js b/ui/scripts/plugins.js index 122f4a03491..6a886ba0ae6 100644 --- a/ui/scripts/plugins.js +++ b/ui/scripts/plugins.js @@ -20,15 +20,20 @@ } var loadCSS = function(path) { - var $link = $(''); + if (document.createStyleSheet) { + // IE-compatible CSS loading + document.createStyleSheet(path); + } else { + var $link = $(''); - $link.attr({ - rel: 'stylesheet', - type: 'text/css', - href: path - }); + $link.attr({ + rel: 'stylesheet', + type: 'text/css', + href: path + }); - $('head').append($link); + $('html head').append($link); + } }; $.extend(cloudStack.pluginAPI, {