From 3e5100749aaa858a80ea2b4e338b43e3295f4577 Mon Sep 17 00:00:00 2001 From: Pavel Reznikov Date: Fri, 27 Feb 2015 16:00:36 -0800 Subject: [PATCH] improve stylesheet creation --- src/gridstack.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/gridstack.js b/src/gridstack.js index 1335299..3b5f477 100644 --- a/src/gridstack.js +++ b/src/gridstack.js @@ -27,8 +27,14 @@ create_stylesheet: function () { var style = document.createElement("style"); - style.appendChild(document.createTextNode("")); - document.head.appendChild(style); + style.setAttribute("type", "text/css"); + if (style.styleSheet) { + style.styleSheet.cssText = ""; + } + else { + style.appendChild(document.createTextNode("")); + } + document.getElementsByTagName('head')[0].appendChild(style); return style.sheet; },