Align the callback param orders

This commit is contained in:
Luke Page
2013-03-19 14:19:02 +00:00
parent 40ce2bc4b4
commit 08fca7a7cc
2 changed files with 13 additions and 13 deletions

View File

@@ -252,7 +252,7 @@ function loadStyleSheet(sheet, callback, reload, remaining) {
var env = new less.tree.parseEnv(less);
env.mime = sheet.type;
loadFile(sheet, env, null, function(e, data, sheet, webInfo, path, newFileInfo) {
loadFile(sheet.href, null, function(e, data, path, newFileInfo, webInfo) {
if (webInfo) {
webInfo.remaining = remaining;
@@ -286,18 +286,18 @@ function loadStyleSheet(sheet, callback, reload, remaining) {
} else {
callback(e, null, null, sheet, webInfo, path);
}
}, reload);
}, env);
}
function loadFile(sheet, env, currentFileInfo, callback) {
function loadFile(originalHref, currentFileInfo, callback, env) {
if (currentFileInfo && currentFileInfo.currentDirectory && !/^([a-z-]+:)?\//.test(sheet.href)) {
sheet.href = currentFileInfo.currentDirectory + sheet.href;
if (currentFileInfo && currentFileInfo.currentDirectory && !/^([a-z-]+:)?\//.test(originalHref)) {
originalHref = currentFileInfo.currentDirectory + originalHref;
}
// sheet may be set to the stylesheet for the initial load or a collection of properties including
// some env variables for imports
var hrefParts = extractUrlParts(sheet.href, window.location.href);
var hrefParts = extractUrlParts(originalHref, window.location.href);
var href = hrefParts.url;
var newFileInfo = {
currentDirectory: hrefParts.path,
@@ -324,18 +324,18 @@ function loadFile(sheet, env, currentFileInfo, callback) {
}
}
xhr(href, sheet.type, function (data, lastModified) {
xhr(href, env.mime, function (data, lastModified) {
// Store data this session
session_cache += data.replace(/@import .+?;/ig, '');
// Use remote copy (re-parse)
try {
callback(null, data, sheet, { lastModified: lastModified }, href, newFileInfo)
callback(null, data, href, newFileInfo, { lastModified: lastModified })
} catch (e) {
callback(e, null, sheet);
callback(e);
}
}, function (status, url) {
callback({ type: 'File', message: "'" + url + "' wasn't found (" + status + ")" }, null, sheet);
callback({ type: 'File', message: "'" + url + "' wasn't found (" + status + ")" });
});
}

View File

@@ -1608,10 +1608,10 @@ if (less.mode === 'browser' || less.mode === 'rhino') {
//
less.Parser.fileLoader = function (path, currentFileInfo, callback, env) {
loadFile({href: path, type: env.mime }, env, currentFileInfo,
function (e, data, sheet, webInfo, path, newFileInfo) {
loadFile(path, currentFileInfo,
function (e, data, path, newFileInfo) {
callback(e, data, path, newFileInfo);
});
}, env);
};
}