[Pkg-javascript-commits] [less.js] 285/285: v2 release

Jonas Smedegaard dr at jones.dk
Mon Oct 26 23:24:03 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 89b5e0493b6088f8606c2a31de8aef14a3984be4
Author: Luke Page <luke.a.page at gmail.com>
Date:   Sun Nov 9 14:28:58 2014 +0000

    v2 release
---
 CHANGELOG.md      | 11 +++++++
 bower.json        |  2 +-
 dist/less.js      | 99 ++++++++++++++++++++++++++++---------------------------
 dist/less.min.js  | 10 +++---
 lib/less/index.js |  2 +-
 package.json      |  2 +-
 6 files changed, 69 insertions(+), 57 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index f9e753e..8989f71 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,14 @@
+# 2.0.0
+
+2014-11-09
+
+ - Fixed multiplication in non strict units mode to take the left operand unit, in the case that the unit cannot be resolved
+ - Some fixes for browser cross-compatibility
+ - browser tests now pass in IE 8-11 and FF
+ - added index.js and browser.js in root as shortcuts
+ - fixed some local variable spellings
+ - support for @counter-style directive
+
 # 2.0.0-b3
 
 2014-11-01
diff --git a/bower.json b/bower.json
index 87b788b..7dbc02e 100644
--- a/bower.json
+++ b/bower.json
@@ -1,6 +1,6 @@
 {
   "name": "less",
-  "version": "2.0.0-b3",
+  "version": "2.0.0",
   "main": "./dist/less.js",
   "ignore": [
     "**/.*",
diff --git a/dist/less.js b/dist/less.js
index 791c216..636c823 100644
--- a/dist/less.js
+++ b/dist/less.js
@@ -1,5 +1,5 @@
 /*!
- * Less - Leaner CSS v2.0.0-b3
+ * Less - Leaner CSS v2.0.0
  * http://lesscss.org
  *
  * Copyright (c) 2009-2014, Alexis Sellier <self at cloudhead.net>
@@ -91,47 +91,47 @@ module.exports = {
         var id = 'less:' + (sheet.title || utils.extractId(href));
 
         // If this has already been inserted into the DOM, we may need to replace it
-        var oldCss = document.getElementById(id);
-        var keepOldCss = false;
+        var oldStyleNode = document.getElementById(id);
+        var keepOldStyleNode = false;
 
         // Create a new stylesheet node for insertion or (if necessary) replacement
-        var css = document.createElement('style');
-        css.setAttribute('type', 'text/css');
+        var styleNode = document.createElement('style');
+        styleNode.setAttribute('type', 'text/css');
         if (sheet.media) {
-            css.setAttribute('media', sheet.media);
+            styleNode.setAttribute('media', sheet.media);
         }
-        css.id = id;
+        styleNode.id = id;
 
-        if (!css.styleSheet) {
-            css.appendChild(document.createTextNode(styles));
+        if (!styleNode.styleSheet) {
+            styleNode.appendChild(document.createTextNode(styles));
 
-            // If new contents match contents of oldCss, don't replace oldCss
-            keepOldCss = (oldCss !== null && oldCss.childNodes.length > 0 && css.childNodes.length > 0 &&
-                oldCss.firstChild.nodeValue === css.firstChild.nodeValue);
+            // If new contents match contents of oldStyleNode, don't replace oldStyleNode
+            keepOldStyleNode = (oldStyleNode !== null && oldStyleNode.childNodes.length > 0 && styleNode.childNodes.length > 0 &&
+                oldStyleNode.firstChild.nodeValue === styleNode.firstChild.nodeValue);
         }
 
         var head = document.getElementsByTagName('head')[0];
 
-        // If there is no oldCss, just append; otherwise, only append if we need
-        // to replace oldCss with an updated stylesheet
-        if (oldCss === null || keepOldCss === false) {
+        // If there is no oldStyleNode, just append; otherwise, only append if we need
+        // to replace oldStyleNode with an updated stylesheet
+        if (oldStyleNode === null || keepOldStyleNode === false) {
             var nextEl = sheet && sheet.nextSibling || null;
             if (nextEl) {
-                nextEl.parentNode.insertBefore(css, nextEl);
+                nextEl.parentNode.insertBefore(styleNode, nextEl);
             } else {
-                head.appendChild(css);
+                head.appendChild(styleNode);
             }
         }
-        if (oldCss && keepOldCss === false) {
-            oldCss.parentNode.removeChild(oldCss);
+        if (oldStyleNode && keepOldStyleNode === false) {
+            oldStyleNode.parentNode.removeChild(oldStyleNode);
         }
 
         // For IE.
         // This needs to happen *after* the style element is added to the DOM, otherwise IE 7 and 8 may crash.
         // See http://social.msdn.microsoft.com/Forums/en-US/7e081b65-878a-4c22-8e68-c10d39c2ed32/internet-explorer-crashes-appending-style-element-to-head
-        if (css.styleSheet) {
+        if (styleNode.styleSheet) {
             try {
-                css.styleSheet.cssText = styles;
+                styleNode.styleSheet.cssText = styles;
             } catch (e) {
                 throw new Error("Couldn't reassign styleSheet.cssText.");
             }
@@ -1092,7 +1092,7 @@ var abstractFileManager = function() {
 
 abstractFileManager.prototype.getPath = function (filename) {
     var j = filename.lastIndexOf('?');
-    if (j < 0) {
+    if (j > 0) {
         filename = filename.slice(0, j);
     }
     j = filename.lastIndexOf('/');
@@ -1719,16 +1719,16 @@ var functionRegistry = require("./function-registry");
 
 var functionCaller = function(name, context, index, currentFileInfo) {
     this.name = name.toLowerCase();
-    this.function = functionRegistry.get(this.name);
+    this.func = functionRegistry.get(this.name);
     this.index = index;
     this.context = context;
     this.currentFileInfo = currentFileInfo;
 };
 functionCaller.prototype.isValid = function() {
-    return Boolean(this.function);
+    return Boolean(this.func);
 };
 functionCaller.prototype.call = function(args) {
-    return this.function.apply(this, args);
+    return this.func.apply(this, args);
 };
 
 module.exports = functionCaller;
@@ -2208,7 +2208,7 @@ module.exports = function(environment, fileManagers) {
     var SourceMapOutput, SourceMapBuilder, ParseTree, ImportManager, Environment;
 
     var less = {
-        version: [2, 0, "0-b2"],
+        version: [2, 0, "0"],
         data: require('./data'),
         tree: require('./tree'),
         Environment: (Environment = require("./environment/environment")),
@@ -2267,7 +2267,14 @@ var LessError = module.exports = function LessError(e, importManager, currentFil
     this.stack = e.stack;
 };
 
-LessError.prototype = Object.create(Error.prototype);
+if (typeof Object.create === 'undefined') {
+    var F = function () {};
+    F.prototype = Error.prototype;
+    LessError.prototype = new F();
+} else {
+    LessError.prototype = Object.create(Error.prototype);
+}
+
 LessError.prototype.constructor = LessError;
 
 },{"./utils":79}],31:[function(require,module,exports){
@@ -4021,6 +4028,10 @@ var Parser = function Parser(context, imports, fileInfo) {
                         hasBlock = true;
                         break;
                     */
+                    case "@counter-style":
+                        hasIdentifier = true;
+                        hasBlock = true;
+                        break;
                     case "@charset":
                         hasIdentifier = true;
                         hasBlock = false;
@@ -4900,13 +4911,11 @@ Call.prototype.accept = function (visitor) {
 };
 //
 // When evaluating a function call,
-// we either find the function in `less.functions` [1],
+// we either find the function in the functionRegistry,
 // in which case we call it, passing the  evaluated arguments,
 // if this returns null or we cannot find the function, we
 // simply print it out as it appeared originally [2].
 //
-// The *functions.js* file contains the built-in functions.
-//
 // The reason why we evaluate the arguments, is in the case where
 // we try to pass a variable to a function, like: `saturate(@color)`.
 // The function should receive the value, not the variable.
@@ -7565,7 +7574,11 @@ var Node = require("./node"),
 var Unit = function (numerator, denominator, backupUnit) {
     this.numerator = numerator ? numerator.slice(0).sort() : [];
     this.denominator = denominator ? denominator.slice(0).sort() : [];
-    this.backupUnit = backupUnit;
+    if (backupUnit) {
+        this.backupUnit = backupUnit;
+    } else if (numerator && numerator.length) {
+        this.backupUnit = numerator[0];
+    }
 };
 
 Unit.prototype = new Node();
@@ -7574,13 +7587,11 @@ Unit.prototype.clone = function () {
     return new Unit(this.numerator.slice(0), this.denominator.slice(0), this.backupUnit);
 };
 Unit.prototype.genCSS = function (context, output) {
-    if (this.numerator.length >= 1) {
-        output.add(this.numerator[0]);
-    } else
-    if (this.denominator.length >= 1) {
-        output.add(this.denominator[0]);
-    } else
-    if ((!context || !context.strictUnits) && this.backupUnit) {
+    // Dimension checks the unit is singular and throws an error if in strict math mode.
+    var strictUnits = context && context.strictUnits;
+    if (this.numerator.length === 1) {
+        output.add(this.numerator[0]); // the ideal situation
+    } else if (!strictUnits && this.backupUnit) {
         output.add(this.backupUnit);
     }
 };
@@ -7640,21 +7651,15 @@ Unit.prototype.usedUnits = function() {
     return result;
 };
 Unit.prototype.cancel = function () {
-    var counter = {}, atomicUnit, i, backup;
+    var counter = {}, atomicUnit, i;
 
     for (i = 0; i < this.numerator.length; i++) {
         atomicUnit = this.numerator[i];
-        if (!backup) {
-            backup = atomicUnit;
-        }
         counter[atomicUnit] = (counter[atomicUnit] || 0) + 1;
     }
 
     for (i = 0; i < this.denominator.length; i++) {
         atomicUnit = this.denominator[i];
-        if (!backup) {
-            backup = atomicUnit;
-        }
         counter[atomicUnit] = (counter[atomicUnit] || 0) - 1;
     }
 
@@ -7677,10 +7682,6 @@ Unit.prototype.cancel = function () {
         }
     }
 
-    if (this.numerator.length === 0 && this.denominator.length === 0 && backup) {
-        this.backupUnit = backup;
-    }
-
     this.numerator.sort();
     this.denominator.sort();
 };
diff --git a/dist/less.min.js b/dist/less.min.js
index 3ebbe52..f9a1591 100644
--- a/dist/less.min.js
+++ b/dist/less.min.js
@@ -1,5 +1,5 @@
 /*!
- * Less - Leaner CSS v2.0.0-b3
+ * Less - Leaner CSS v2.0.0
  * http://lesscss.org
  *
  * Copyright (c) 2009-2014, Alexis Sellier <self at cloudhead.net>
@@ -10,8 +10,8 @@
  /** * @license Apache v2
  */
 
-!function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;"undefined"!=typeof window?b=window:"undefined"!=typeof global?b=global:"undefined"!=typeof self&&(b=self),b.less=a()}}(function(){return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.co [...]
-return d=d?d instanceof b?d.value:d.toCSS():"",new c(a.value,d)},"get-unit":function(a){return new f(a.unit)},extract:function(a,b){return b=b.value-1,Array.isArray(a.value)?a.value[b]:Array(a)[b]},length:function(a){var b=Array.isArray(a.value)?a.value.length:1;return new c(b)}})},{"../tree/anonymous":42,"../tree/color":46,"../tree/dimension":52,"../tree/keyword":61,"../tree/operation":67,"../tree/quoted":69,"../tree/url":76,"./function-registry":21}],28:[function(a,b){var c=a("./contex [...]
-};e.prototype=new c,e.prototype.type="Call",e.prototype.accept=function(a){this.args&&(this.args=a.visitArray(this.args))},e.prototype.eval=function(a){var b,c=this.args.map(function(b){return b.eval(a)}),f=new d(this.name,a,this.index,this.currentFileInfo);if(f.isValid())try{if(b=f.call(c),null!=b)return b}catch(g){throw{type:g.type||"Runtime",message:"error evaluating function `"+this.name+"`"+(g.message?": "+g.message:""),index:this.index,filename:this.currentFileInfo.filename}}return [...]
-return b.callEval(a)},b.exports=e},{"./node":66,"./variable":78}],72:[function(a,b){var c=a("./node"),d=a("./rule"),e=a("./selector"),f=a("./element"),g=a("../contexts"),h=a("../functions/default"),i=a("./debug-info"),j=function(a,b,c){this.selectors=a,this.rules=b,this._lookups={},this.strictImports=c};j.prototype=new c,j.prototype.type="Ruleset",j.prototype.isRuleset=!0,j.prototype.isRulesetLike=!0,j.prototype.accept=function(a){this.paths?a.visitArray(this.paths,!0):this.selectors&&(t [...]
+!function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;"undefined"!=typeof window?b=window:"undefined"!=typeof global?b=global:"undefined"!=typeof self&&(b=self),b.less=a()}}(function(){return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.co [...]
+return d=d?d instanceof b?d.value:d.toCSS():"",new c(a.value,d)},"get-unit":function(a){return new f(a.unit)},extract:function(a,b){return b=b.value-1,Array.isArray(a.value)?a.value[b]:Array(a)[b]},length:function(a){var b=Array.isArray(a.value)?a.value.length:1;return new c(b)}})},{"../tree/anonymous":42,"../tree/color":46,"../tree/dimension":52,"../tree/keyword":61,"../tree/operation":67,"../tree/quoted":69,"../tree/url":76,"./function-registry":21}],28:[function(a,b){var c=a("./contex [...]
+},b.exports=d},{"./node":66}],45:[function(a,b){var c=a("./node"),d=a("../functions/function-caller"),e=function(a,b,c,d){this.name=a,this.args=b,this.index=c,this.currentFileInfo=d};e.prototype=new c,e.prototype.type="Call",e.prototype.accept=function(a){this.args&&(this.args=a.visitArray(this.args))},e.prototype.eval=function(a){var b,c=this.args.map(function(b){return b.eval(a)}),f=new d(this.name,a,this.index,this.currentFileInfo);if(f.isValid())try{if(b=f.call(c),null!=b)return b}ca [...]
+};e.prototype=new c,e.prototype.type="RulesetCall",e.prototype.eval=function(a){var b=new d(this.variable).eval(a);return b.callEval(a)},b.exports=e},{"./node":66,"./variable":78}],72:[function(a,b){var c=a("./node"),d=a("./rule"),e=a("./selector"),f=a("./element"),g=a("../contexts"),h=a("../functions/default"),i=a("./debug-info"),j=function(a,b,c){this.selectors=a,this.rules=b,this._lookups={},this.strictImports=c};j.prototype=new c,j.prototype.type="Ruleset",j.prototype.isRuleset=!0,j. [...]
 a.then(null,function(a){setTimeout(function(){throw a},0)})})},{}],"promise/polyfill.js":[function(a){a("asap");"undefined"==typeof Promise&&(Promise=a("./lib/core.js"),a("./lib/es6-extensions.js")),a("./polyfill-done.js")},{"./lib/core.js":88,"./lib/es6-extensions.js":89,"./polyfill-done.js":91,asap:90}]},{},[2])(2)});
\ No newline at end of file
diff --git a/lib/less/index.js b/lib/less/index.js
index b46cd03..e911907 100644
--- a/lib/less/index.js
+++ b/lib/less/index.js
@@ -2,7 +2,7 @@ module.exports = function(environment, fileManagers) {
     var SourceMapOutput, SourceMapBuilder, ParseTree, ImportManager, Environment;
 
     var less = {
-        version: [2, 0, "0-b2"],
+        version: [2, 0, "0"],
         data: require('./data'),
         tree: require('./tree'),
         Environment: (Environment = require("./environment/environment")),
diff --git a/package.json b/package.json
index 4283648..317e775 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "less",
-  "version": "2.0.0-b3",
+  "version": "2.0.0",
   "description": "Leaner CSS",
   "homepage": "http://lesscss.org",
   "author": {

-- 
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