get most of the browser tests running

This commit is contained in:
Luke Page
2014-02-28 18:07:56 +00:00
parent 3229b45fea
commit 418af74c27
2 changed files with 13 additions and 10 deletions

View File

@@ -6,6 +6,13 @@
var less = require('./non-node-index.js'),
options = window.less;
var logLevel = {
debug: 3,
info: 2,
errors: 1,
none: 0
};
function log(str, level) {
if (typeof(console) !== 'undefined' && less.logLevel >= level) {
console.log('less: ' + str);
@@ -14,7 +21,7 @@ function log(str, level) {
var isFileProtocol = /^(file|chrome(-extension)?|resource|qrc|app):/.test(location.protocol);
less.environment = require("./environments/browser.js")(less, isFileProtocol, log, 1/*TODO*/);
less.environment = require("./environments/browser.js")(less, isFileProtocol, log, logLevel);
window.less = less;
less.env = options.env || (location.hostname == '127.0.0.1' ||
@@ -25,13 +32,6 @@ less.env = options.env || (location.hostname == '127.0.0.1' ||
isFileProtocol ? 'development'
: 'production');
var logLevel = {
debug: 3,
info: 2,
errors: 1,
none: 0
};
// The amount of logging in the javascript console.
// 3 - Debug, information and errors
// 2 - Information and errors
@@ -308,7 +308,7 @@ function loadStyles(modifyVars) {
for (var i = 0; i < styles.length; i++) {
style = styles[i];
if (style.type.match(typePattern)) {
var env = new less.tree.parseEnv(less),
var env = new less.tree.parseEnv(options),
lessText = style.innerHTML || '';
env.filename = document.location.href.replace(/#.*$/, '');
@@ -339,7 +339,7 @@ function loadStyles(modifyVars) {
function loadStyleSheet(sheet, callback, reload, remaining, modifyVars) {
var env = new less.tree.parseEnv(less);
var env = new less.tree.parseEnv(options);
env.mime = sheet.type;
if (modifyVars || options.globalVars) {

View File

@@ -44,6 +44,8 @@ return {
alwaysMakePathsAbsolute: function alwaysMakePathsAbsolute() {
return true;
},
getCleanCSS: function () {
},
pathDiff: function pathDiff(url, baseUrl) {
// diff between two paths to create a relative path
@@ -128,6 +130,7 @@ return {
return returner;
},
doXHR: function doXHR(url, type, callback, errback) {
var xhr = getXMLHttpRequest();
var async = isFileProtocol ? less.fileAsync : less.async;