diff --git a/lib/less/browser.js b/lib/less/browser.js index 544ec5a..8eff091 100644 --- a/lib/less/browser.js +++ b/lib/less/browser.js @@ -2,7 +2,9 @@ // browser.js - client-side engine // -var isFileProtocol = location.protocol === 'file:'; +var isFileProtocol = (location.protocol === 'file:' || + location.protocol === 'chrome:' || + location.protocol === 'resource:'); less.env = location.hostname == '127.0.0.1' || location.hostname == '0.0.0.0' || @@ -47,7 +49,12 @@ if (less.env === 'development') { less.optimization = 3; } -var cache = (typeof(window.localStorage) === 'undefined') ? null : window.localStorage; +var cache; +try { + cache = (typeof(window.localStorage) === 'undefined') ? null : window.localStorage; +} catch (e) { + cache = null; +} // // Get all tags with the 'rel' attribute set to "stylesheet/less" @@ -167,6 +174,9 @@ function xhr(url, callback, errback) { var xhr = getXMLHttpRequest(); var async = isFileProtocol ? false : less.async; + if (typeof xhr.overrideMimeType === 'function') { + xhr.overrideMimeType('text/css'); + } xhr.open('GET', url, async); xhr.send(null); diff --git a/lib/less/parser.js b/lib/less/parser.js index 3210848..e712842 100644 --- a/lib/less/parser.js +++ b/lib/less/parser.js @@ -229,7 +229,11 @@ less.Parser = function Parser(env) { chunks[++j] = []; } else { if (c === '"' || c === "'") { - inString = inString === c ? false : c; + if (!inString) { + inString = c; + } else { + inString = inString === c ? false : inString; + } } chunk.push(c); }