UI plugin API: Support IE-compatible CSS loading

If browser is IE < 9, use document.createStyleSheet to properly load
plugin's CSS dynamically.
This commit is contained in:
Brian Federle 2013-05-07 15:44:28 -07:00
parent 732566e703
commit 5b74b4d6fe
1 changed files with 12 additions and 7 deletions

View File

@ -20,15 +20,20 @@
}
var loadCSS = function(path) {
var $link = $('<link>');
if (document.createStyleSheet) {
// IE-compatible CSS loading
document.createStyleSheet(path);
} else {
var $link = $('<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, {