mirror of
https://github.com/less/less.js.git
synced 2026-01-24 14:48:00 -05:00
get most of the browser tests running
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user