From f255aefccfafef05048f531792a778ac4f8056ce Mon Sep 17 00:00:00 2001 From: Cotton Hou Date: Sun, 11 Dec 2011 14:37:53 +0800 Subject: [PATCH 1/2] Shift the type setting in order to work with Webkit, and fix typo for IE. --- lib/less/browser.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/less/browser.js b/lib/less/browser.js index 77e59ae1..b38a3d59 100644 --- a/lib/less/browser.js +++ b/lib/less/browser.js @@ -103,12 +103,12 @@ function loadStyles() { new(less.Parser)().parse(styles[i].innerHTML || '', function (e, tree) { var css = tree.toCSS(); var style = styles[i]; + style.type = 'text/css'; try { style.innerHTML = css; } catch (_) { - style.styleSheets.cssText = css; + style.styleSheet.cssText = css; } - style.type = 'text/css'; }); } } From 7a033af705c7370dfac0f7a67b773daad0dc8bb3 Mon Sep 17 00:00:00 2001 From: Cotton Hou Date: Mon, 12 Dec 2011 15:57:50 +0800 Subject: [PATCH 2/2] Use if rather than try --- lib/less/browser.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/less/browser.js b/lib/less/browser.js index b38a3d59..9e4afb7f 100644 --- a/lib/less/browser.js +++ b/lib/less/browser.js @@ -104,10 +104,10 @@ function loadStyles() { var css = tree.toCSS(); var style = styles[i]; style.type = 'text/css'; - try { - style.innerHTML = css; - } catch (_) { + if (style.styleSheet) { style.styleSheet.cssText = css; + } else { + style.innerHTML = css; } }); }