[Pkg-javascript-commits] [less.js] 148/285: Fix some more browser tests

Jonas Smedegaard dr at jones.dk
Mon Oct 26 23:23:48 UTC 2015


This is an automated email from the git hooks/post-receive script.

js pushed a commit to annotated tag v2.0.0
in repository less.js.

commit ee9eefd94f47e037231392d5ee66edd0f77af8de
Author: Luke Page <luke.a.page at gmail.com>
Date:   Sun Oct 5 09:30:00 2014 +0100

    Fix some more browser tests
---
 Gruntfile.js                       |  2 +-
 lib/less-browser/browser-import.js | 25 ++++---------------------
 lib/less/imports.js                |  2 +-
 3 files changed, 6 insertions(+), 23 deletions(-)

diff --git a/Gruntfile.js b/Gruntfile.js
index 126cb23..37275a7 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -37,7 +37,7 @@ module.exports = function (grunt) {
                 command: 'node benchmark/less-benchmark.js'
             },
             "browsertest-server": {
-                command: 'node node_modules/http-server/bin/http-server . -p 8088'
+                command: 'node node_modules/http-server/bin/http-server . -p 8081'
             },
             "sourcemap-test": {
                 command: [
diff --git a/lib/less-browser/browser-import.js b/lib/less-browser/browser-import.js
index 997f692..d2e49ae 100644
--- a/lib/less-browser/browser-import.js
+++ b/lib/less-browser/browser-import.js
@@ -32,28 +32,11 @@ BrowserImport.prototype = new AbstractFileManager();
 BrowserImport.prototype.alwaysMakePathsAbsolute = function alwaysMakePathsAbsolute() {
     return true;
 };
-BrowserImport.prototype.join = function (url, baseUrl) {
-    // diff between two paths to create a relative path
-
-    var urlParts = this.extractUrlParts(url),
-        baseUrlParts = this.extractUrlParts(baseUrl),
-        i, max, urlDirectories, baseUrlDirectories, diff = "";
-    if (urlParts.hostPart !== baseUrlParts.hostPart) {
-        return "";
+BrowserImport.prototype.join = function join(basePath, laterPath) {
+    if (!basePath) {
+        return laterPath;
     }
-    max = Math.max(baseUrlParts.directories.length, urlParts.directories.length);
-    for(i = 0; i < max; i++) {
-        if (baseUrlParts.directories[i] !== urlParts.directories[i]) { break; }
-    }
-    baseUrlDirectories = baseUrlParts.directories.slice(i);
-    urlDirectories = urlParts.directories.slice(i);
-    for(i = 0; i < baseUrlDirectories.length-1; i++) {
-        diff += "../";
-    }
-    for(i = 0; i < urlDirectories.length-1; i++) {
-        diff += urlDirectories[i] + "/";
-    }
-    return diff;
+    return this.extractUrlParts(laterPath, basePath).path;
 };
 BrowserImport.prototype.doXHR = function doXHR(url, type, callback, errback) {
 
diff --git a/lib/less/imports.js b/lib/less/imports.js
index a8299c5..00bedc3 100644
--- a/lib/less/imports.js
+++ b/lib/less/imports.js
@@ -69,7 +69,7 @@ module.exports = function(environment) {
                 //   then rootpath should become 'less/../'
                 newFileInfo.currentDirectory = fileManager.getPath(resolvedFilename);
                 if(newFileInfo.relativeUrls) {
-                    newFileInfo.rootpath = fileManager.join((parserImports.env.rootpath || ""), environment.pathDiff(newFileInfo.currentDirectory, newFileInfo.entryPath));
+                    newFileInfo.rootpath = fileManager.join((parserImports.env.rootpath || ""), fileManager.pathDiff(newFileInfo.currentDirectory, newFileInfo.entryPath));
                     if (!fileManager.isPathAbsolute(newFileInfo.rootpath) && fileManager.alwaysMakePathsAbsolute()) {
                         newFileInfo.rootpath = fileManager.join(newFileInfo.entryPath, newFileInfo.rootpath);
                     }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/less.js.git



More information about the Pkg-javascript-commits mailing list