less 2.3.0 → 2.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.idea/inspectionProfiles/Project_Default.xml +1 -0
- package/.idea/jsLinters/jscs.xml +4 -0
- package/.idea/jsLinters/jshint.xml +58 -4
- package/.idea/workspace.xml +427 -892
- package/.jscsrc +34 -2
- package/.jshintrc +0 -1
- package/CHANGELOG.md +7 -0
- package/bin/lessc +8 -3
- package/bower.json +1 -1
- package/dist/less.js +362 -245
- package/dist/less.min.js +5 -5
- package/lib/less/data/unit-conversions.js +3 -3
- package/lib/less/environment/abstract-file-manager.js +4 -4
- package/lib/less/functions/color-blending.js +3 -3
- package/lib/less/functions/color.js +7 -7
- package/lib/less/functions/data-uri.js +3 -2
- package/lib/less/functions/string.js +3 -1
- package/lib/less/functions/svg.js +6 -3
- package/lib/less/functions/types.js +3 -1
- package/lib/less/import-manager.js +4 -1
- package/lib/less/index.js +1 -1
- package/lib/less/parser/parser.js +12 -7
- package/lib/less/source-map-output.js +3 -3
- package/lib/less/transform-tree.js +1 -1
- package/lib/less/tree/condition.js +1 -1
- package/lib/less/tree/debug-info.js +6 -2
- package/lib/less/tree/dimension.js +1 -1
- package/lib/less/tree/directive.js +15 -3
- package/lib/less/tree/import.js +1 -1
- package/lib/less/tree/media.js +3 -2
- package/lib/less/tree/mixin-call.js +3 -4
- package/lib/less/tree/mixin-definition.js +4 -3
- package/lib/less/tree/quoted.js +1 -1
- package/lib/less/tree/rule.js +2 -3
- package/lib/less/tree/ruleset.js +223 -149
- package/lib/less/tree/selector.js +2 -1
- package/lib/less/tree/url.js +1 -1
- package/lib/less/tree/value.js +1 -1
- package/lib/less/tree/variable.js +1 -1
- package/lib/less/visitors/extend-visitor.js +30 -22
- package/lib/less/visitors/import-visitor.js +2 -1
- package/lib/less/visitors/to-css-visitor.js +5 -4
- package/lib/less-browser/utils.js +5 -5
- package/lib/less-node/file-manager.js +8 -4
- package/lib/less-node/url-file-manager.js +2 -2
- package/lib/less-rhino/index.js +2 -2
- package/package.json +3 -3
- package/test/browser/common.js +3 -3
- package/test/browser/jasmine-jsreporter.js +2 -2
- package/test/browser/less.js +29 -0
- package/test/copy-bom.js +14 -8
- package/test/css/selectors.css +9 -0
- package/test/index.js +1 -1
- package/test/less/selectors.less +18 -3
- package/test/less-bom/charsets.less +3 -0
- package/test/less-bom/colors.less +98 -0
- package/test/less-bom/comments.less +102 -0
- package/test/less-bom/comments2.less +20 -0
- package/test/less-bom/compression/compression.less +36 -0
- package/test/less-bom/css-3.less +154 -0
- package/test/less-bom/css-escapes.less +33 -0
- package/test/less-bom/css-guards.less +103 -0
- package/test/less-bom/css.less +108 -0
- package/test/less-bom/debug/import/test.less +25 -0
- package/test/less-bom/debug/linenumbers.less +33 -0
- package/test/less-bom/detached-rulesets.less +103 -0
- package/test/less-bom/empty.less +1 -0
- package/test/less-bom/errors/add-mixed-units.less +3 -0
- package/test/less-bom/errors/add-mixed-units.txt +4 -0
- package/test/less-bom/errors/add-mixed-units2.less +3 -0
- package/test/less-bom/errors/add-mixed-units2.txt +4 -0
- package/test/less-bom/errors/at-rules-undefined-var.less +4 -0
- package/test/less-bom/errors/at-rules-undefined-var.txt +4 -0
- package/test/less-bom/errors/bad-variable-declaration1.less +1 -0
- package/test/less-bom/errors/bad-variable-declaration1.txt +2 -0
- package/test/less-bom/errors/color-func-invalid-color.less +3 -0
- package/test/less-bom/errors/color-func-invalid-color.txt +4 -0
- package/test/less-bom/errors/color-invalid-hex-code.less +3 -0
- package/test/less-bom/errors/color-invalid-hex-code.txt +4 -0
- package/test/less-bom/errors/color-invalid-hex-code2.less +3 -0
- package/test/less-bom/errors/color-invalid-hex-code2.txt +4 -0
- package/test/less-bom/errors/css-guard-default-func.less +4 -0
- package/test/less-bom/errors/css-guard-default-func.txt +4 -0
- package/test/less-bom/errors/detached-ruleset-1.less +6 -0
- package/test/less-bom/errors/detached-ruleset-1.txt +4 -0
- package/test/less-bom/errors/detached-ruleset-2.less +6 -0
- package/test/less-bom/errors/detached-ruleset-2.txt +4 -0
- package/test/less-bom/errors/detached-ruleset-3.less +4 -0
- package/test/less-bom/errors/detached-ruleset-3.txt +4 -0
- package/test/less-bom/errors/detached-ruleset-4.less +5 -0
- package/test/less-bom/errors/detached-ruleset-4.txt +4 -0
- package/test/less-bom/errors/detached-ruleset-5.less +4 -0
- package/test/less-bom/errors/detached-ruleset-5.txt +3 -0
- package/test/less-bom/errors/detached-ruleset-6.less +5 -0
- package/test/less-bom/errors/detached-ruleset-6.txt +4 -0
- package/test/less-bom/errors/divide-mixed-units.less +3 -0
- package/test/less-bom/errors/divide-mixed-units.txt +4 -0
- package/test/less-bom/errors/extend-no-selector.less +3 -0
- package/test/less-bom/errors/extend-no-selector.txt +3 -0
- package/test/less-bom/errors/extend-not-at-end.less +3 -0
- package/test/less-bom/errors/extend-not-at-end.txt +3 -0
- package/test/less-bom/errors/import-malformed.less +1 -0
- package/test/less-bom/errors/import-malformed.txt +3 -0
- package/test/less-bom/errors/import-missing.less +6 -0
- package/test/less-bom/errors/import-missing.txt +3 -0
- package/test/less-bom/errors/import-no-semi.less +1 -0
- package/test/less-bom/errors/import-no-semi.txt +2 -0
- package/test/less-bom/errors/import-subfolder1.less +1 -0
- package/test/less-bom/errors/import-subfolder1.txt +3 -0
- package/test/less-bom/errors/import-subfolder2.less +1 -0
- package/test/less-bom/errors/import-subfolder2.txt +4 -0
- package/test/less-bom/errors/imports/import-subfolder1.less +1 -0
- package/test/less-bom/errors/imports/import-subfolder2.less +1 -0
- package/test/less-bom/errors/imports/import-test.less +4 -0
- package/test/less-bom/errors/imports/subfolder/mixin-not-defined.less +1 -0
- package/test/less-bom/errors/imports/subfolder/parse-error-curly-bracket.less +1 -0
- package/test/less-bom/errors/javascript-error.less +3 -0
- package/test/less-bom/errors/javascript-error.txt +4 -0
- package/test/less-bom/errors/javascript-undefined-var.less +3 -0
- package/test/less-bom/errors/javascript-undefined-var.txt +4 -0
- package/test/less-bom/errors/mixed-mixin-definition-args-1.less +6 -0
- package/test/less-bom/errors/mixed-mixin-definition-args-1.txt +4 -0
- package/test/less-bom/errors/mixed-mixin-definition-args-2.less +6 -0
- package/test/less-bom/errors/mixed-mixin-definition-args-2.txt +4 -0
- package/test/less-bom/errors/mixin-not-defined.less +11 -0
- package/test/less-bom/errors/mixin-not-defined.txt +3 -0
- package/test/less-bom/errors/mixin-not-matched.less +6 -0
- package/test/less-bom/errors/mixin-not-matched.txt +3 -0
- package/test/less-bom/errors/mixin-not-matched2.less +6 -0
- package/test/less-bom/errors/mixin-not-matched2.txt +3 -0
- package/test/less-bom/errors/mixin-not-visible-in-scope-1.less +9 -0
- package/test/less-bom/errors/mixin-not-visible-in-scope-1.txt +4 -0
- package/test/less-bom/errors/mixins-guards-default-func-1.less +9 -0
- package/test/less-bom/errors/mixins-guards-default-func-1.txt +4 -0
- package/test/less-bom/errors/mixins-guards-default-func-2.less +9 -0
- package/test/less-bom/errors/mixins-guards-default-func-2.txt +4 -0
- package/test/less-bom/errors/mixins-guards-default-func-3.less +9 -0
- package/test/less-bom/errors/mixins-guards-default-func-3.txt +4 -0
- package/test/less-bom/errors/multiple-guards-on-css-selectors.less +4 -0
- package/test/less-bom/errors/multiple-guards-on-css-selectors.txt +4 -0
- package/test/less-bom/errors/multiple-guards-on-css-selectors2.less +4 -0
- package/test/less-bom/errors/multiple-guards-on-css-selectors2.txt +4 -0
- package/test/less-bom/errors/multiply-mixed-units.less +7 -0
- package/test/less-bom/errors/multiply-mixed-units.txt +4 -0
- package/test/less-bom/errors/parens-error-1.less +3 -0
- package/test/less-bom/errors/parens-error-1.txt +4 -0
- package/test/less-bom/errors/parens-error-2.less +3 -0
- package/test/less-bom/errors/parens-error-2.txt +4 -0
- package/test/less-bom/errors/parens-error-3.less +3 -0
- package/test/less-bom/errors/parens-error-3.txt +4 -0
- package/test/less-bom/errors/parse-error-curly-bracket.less +4 -0
- package/test/less-bom/errors/parse-error-curly-bracket.txt +4 -0
- package/test/less-bom/errors/parse-error-extra-parens.less +5 -0
- package/test/less-bom/errors/parse-error-extra-parens.txt +3 -0
- package/test/less-bom/errors/parse-error-missing-bracket.less +2 -0
- package/test/less-bom/errors/parse-error-missing-bracket.txt +3 -0
- package/test/less-bom/errors/parse-error-missing-parens.less +5 -0
- package/test/less-bom/errors/parse-error-missing-parens.txt +3 -0
- package/test/less-bom/errors/parse-error-with-import.less +13 -0
- package/test/less-bom/errors/parse-error-with-import.txt +4 -0
- package/test/less-bom/errors/percentage-missing-space.less +3 -0
- package/test/less-bom/errors/percentage-missing-space.txt +4 -0
- package/test/less-bom/errors/property-asterisk-only-name.less +3 -0
- package/test/less-bom/errors/property-asterisk-only-name.txt +4 -0
- package/test/less-bom/errors/property-ie5-hack.less +3 -0
- package/test/less-bom/errors/property-ie5-hack.txt +3 -0
- package/test/less-bom/errors/property-in-root.less +4 -0
- package/test/less-bom/errors/property-in-root.txt +4 -0
- package/test/less-bom/errors/property-in-root2.less +1 -0
- package/test/less-bom/errors/property-in-root2.txt +4 -0
- package/test/less-bom/errors/property-in-root3.less +4 -0
- package/test/less-bom/errors/property-in-root3.txt +3 -0
- package/test/less-bom/errors/property-interp-not-defined.less +1 -0
- package/test/less-bom/errors/property-interp-not-defined.txt +2 -0
- package/test/less-bom/errors/recursive-variable.less +1 -0
- package/test/less-bom/errors/recursive-variable.txt +2 -0
- package/test/less-bom/errors/single-character.less +1 -0
- package/test/less-bom/errors/single-character.txt +2 -0
- package/test/less-bom/errors/svg-gradient1.less +3 -0
- package/test/less-bom/errors/svg-gradient1.txt +4 -0
- package/test/less-bom/errors/svg-gradient2.less +3 -0
- package/test/less-bom/errors/svg-gradient2.txt +4 -0
- package/test/less-bom/errors/svg-gradient3.less +3 -0
- package/test/less-bom/errors/svg-gradient3.txt +4 -0
- package/test/less-bom/errors/unit-function.less +3 -0
- package/test/less-bom/errors/unit-function.txt +4 -0
- package/test/less-bom/extend-chaining.less +91 -0
- package/test/less-bom/extend-clearfix.less +19 -0
- package/test/less-bom/extend-exact.less +46 -0
- package/test/less-bom/extend-media.less +24 -0
- package/test/less-bom/extend-nest.less +65 -0
- package/test/less-bom/extend-selector.less +99 -0
- package/test/less-bom/extend.less +81 -0
- package/test/less-bom/extract-and-length.less +133 -0
- package/test/less-bom/functions.less +201 -0
- package/test/less-bom/globalVars/extended.json +5 -0
- package/test/less-bom/globalVars/extended.less +10 -0
- package/test/less-bom/globalVars/simple.json +3 -0
- package/test/less-bom/globalVars/simple.less +3 -0
- package/test/less-bom/ie-filters.less +15 -0
- package/test/less-bom/import/deeper/deeper-2/url-import-2.less +3 -0
- package/test/less-bom/import/deeper/deeper-2/url-import.less +1 -0
- package/test/less-bom/import/deeper/import-once-test-a.less +1 -0
- package/test/less-bom/import/deeper/url-import.less +1 -0
- package/test/less-bom/import/import-and-relative-paths-test.less +17 -0
- package/test/less-bom/import/import-charset-test.less +1 -0
- package/test/less-bom/import/import-interpolation.less +2 -0
- package/test/less-bom/import/import-interpolation2.less +5 -0
- package/test/less-bom/import/import-once-test-c.less +6 -0
- package/test/less-bom/import/import-reference.less +89 -0
- package/test/less-bom/import/import-test-a.less +4 -0
- package/test/less-bom/import/import-test-b.less +8 -0
- package/test/less-bom/import/import-test-c.less +6 -0
- package/test/less-bom/import/import-test-d.css +1 -0
- package/test/less-bom/import/import-test-e.less +2 -0
- package/test/less-bom/import/import-test-f.less +5 -0
- package/test/less-bom/import/imports/font.less +8 -0
- package/test/less-bom/import/imports/logo.less +5 -0
- package/test/less-bom/import/interpolation-vars.less +6 -0
- package/test/less-bom/import/invalid-css.less +1 -0
- package/test/less-bom/import/urls.less +1 -0
- package/test/less-bom/import-inline.less +3 -0
- package/test/less-bom/import-interpolation.less +8 -0
- package/test/less-bom/import-once.less +6 -0
- package/test/less-bom/import-reference.less +23 -0
- package/test/less-bom/import.less +30 -0
- package/test/less-bom/include-path/include-path.less +6 -0
- package/test/less-bom/javascript.less +38 -0
- package/test/less-bom/lazy-eval.less +6 -0
- package/test/less-bom/legacy/legacy.less +7 -0
- package/test/less-bom/media.less +234 -0
- package/test/less-bom/merge.less +78 -0
- package/test/less-bom/mixins-args.less +215 -0
- package/test/less-bom/mixins-closure.less +26 -0
- package/test/less-bom/mixins-guards-default-func.less +195 -0
- package/test/less-bom/mixins-guards.less +271 -0
- package/test/less-bom/mixins-important.less +37 -0
- package/test/less-bom/mixins-interpolated.less +75 -0
- package/test/less-bom/mixins-named-args.less +36 -0
- package/test/less-bom/mixins-nested.less +22 -0
- package/test/less-bom/mixins-pattern.less +102 -0
- package/test/less-bom/mixins.less +145 -0
- package/test/less-bom/modifyVars/extended.json +5 -0
- package/test/less-bom/modifyVars/extended.less +11 -0
- package/test/less-bom/nested-gradient-with-svg-gradient/mixin-consumer.less +5 -0
- package/test/less-bom/nested-gradient-with-svg-gradient/svg-gradient-mixin.less +15 -0
- package/test/less-bom/no-js-errors/no-js-errors.less +3 -0
- package/test/less-bom/no-js-errors/no-js-errors.txt +4 -0
- package/test/less-bom/no-output.less +2 -0
- package/test/less-bom/operations.less +62 -0
- package/test/less-bom/parens.less +45 -0
- package/test/less-bom/property-name-interp.less +56 -0
- package/test/less-bom/rulesets.less +30 -0
- package/test/less-bom/scope.less +104 -0
- package/test/less-bom/selectors.less +174 -0
- package/test/less-bom/sourcemaps/basic.json +3 -0
- package/test/less-bom/sourcemaps/basic.less +27 -0
- package/test/less-bom/sourcemaps/imported.css +7 -0
- package/test/less-bom/static-urls/urls.less +33 -0
- package/test/less-bom/strict-units/strict-units.less +4 -0
- package/test/less-bom/strings.less +73 -0
- package/test/less-bom/url-args/urls.less +63 -0
- package/test/less-bom/urls.less +94 -0
- package/test/less-bom/variables-in-at-rules.less +20 -0
- package/test/less-bom/variables.less +119 -0
- package/test/less-bom/whitespace.less +44 -0
- package/test/less-test.js +2 -2
- package/test/modify-vars.js +6 -4
|
@@ -61,7 +61,7 @@ ExtendFinderVisitor.prototype = {
|
|
|
61
61
|
extend.findSelfSelectors(selectorPath);
|
|
62
62
|
extend.ruleset = rulesetNode;
|
|
63
63
|
if (j === 0) { extend.firstExtendOnThisSelectorPath = true; }
|
|
64
|
-
this.allExtendsStack[this.allExtendsStack.length-1].push(extend);
|
|
64
|
+
this.allExtendsStack[this.allExtendsStack.length - 1].push(extend);
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
|
|
@@ -116,21 +116,22 @@ ProcessExtendsVisitor.prototype = {
|
|
|
116
116
|
|
|
117
117
|
if(!indicies[extend.index + ' ' + selector]) {
|
|
118
118
|
indicies[extend.index + ' ' + selector] = true;
|
|
119
|
-
logger.warn("extend '"+selector+"' has no matches");
|
|
119
|
+
logger.warn("extend '" + selector + "' has no matches");
|
|
120
120
|
}
|
|
121
121
|
});
|
|
122
122
|
},
|
|
123
123
|
doExtendChaining: function (extendsList, extendsListTarget, iterationCount) {
|
|
124
124
|
//
|
|
125
|
-
// chaining is different from normal extension.. if we extend an extend then we are not just copying, altering
|
|
126
|
-
// the selector we would do normally, but we are also adding an extend with the same target selector
|
|
125
|
+
// chaining is different from normal extension.. if we extend an extend then we are not just copying, altering
|
|
126
|
+
// and pasting the selector we would do normally, but we are also adding an extend with the same target selector
|
|
127
127
|
// this means this new extend can then go and alter other extends
|
|
128
128
|
//
|
|
129
129
|
// this method deals with all the chaining work - without it, extend is flat and doesn't work on other extend selectors
|
|
130
|
-
// this is also the most expensive.. and a match on one selector can cause an extension of a selector we had already
|
|
131
|
-
// we look at each selector at a time, as is done in visitRuleset
|
|
130
|
+
// this is also the most expensive.. and a match on one selector can cause an extension of a selector we had already
|
|
131
|
+
// processed if we look at each selector at a time, as is done in visitRuleset
|
|
132
132
|
|
|
133
|
-
var extendIndex, targetExtendIndex, matches, extendsToAdd = [], newSelector, extendVisitor = this, selectorPath,
|
|
133
|
+
var extendIndex, targetExtendIndex, matches, extendsToAdd = [], newSelector, extendVisitor = this, selectorPath,
|
|
134
|
+
extend, targetExtend, newExtend;
|
|
134
135
|
|
|
135
136
|
iterationCount = iterationCount || 0;
|
|
136
137
|
|
|
@@ -168,7 +169,7 @@ ProcessExtendsVisitor.prototype = {
|
|
|
168
169
|
newExtend.selfSelectors = newSelector;
|
|
169
170
|
|
|
170
171
|
// add the extend onto the list of extends for that selector
|
|
171
|
-
newSelector[newSelector.length-1].extendList = [newExtend];
|
|
172
|
+
newSelector[newSelector.length - 1].extendList = [newExtend];
|
|
172
173
|
|
|
173
174
|
// record that we need to add it.
|
|
174
175
|
extendsToAdd.push(newExtend);
|
|
@@ -202,11 +203,13 @@ ProcessExtendsVisitor.prototype = {
|
|
|
202
203
|
selectorTwo = extendsToAdd[0].selector.toCSS();
|
|
203
204
|
}
|
|
204
205
|
catch(e) {}
|
|
205
|
-
throw {message: "extend circular reference detected. One of the circular extends is currently:"
|
|
206
|
+
throw { message: "extend circular reference detected. One of the circular extends is currently:" +
|
|
207
|
+
selectorOne + ":extend(" + selectorTwo + ")"};
|
|
206
208
|
}
|
|
207
209
|
|
|
208
|
-
// now process the new extends on the existing rules so that we can handle a extending b extending c
|
|
209
|
-
|
|
210
|
+
// now process the new extends on the existing rules so that we can handle a extending b extending c extending
|
|
211
|
+
// d extending e...
|
|
212
|
+
return extendsToAdd.concat(extendVisitor.doExtendChaining(extendsToAdd, extendsListTarget, iterationCount + 1));
|
|
210
213
|
} else {
|
|
211
214
|
return extendsToAdd;
|
|
212
215
|
}
|
|
@@ -224,7 +227,8 @@ ProcessExtendsVisitor.prototype = {
|
|
|
224
227
|
if (rulesetNode.root) {
|
|
225
228
|
return;
|
|
226
229
|
}
|
|
227
|
-
var matches, pathIndex, extendIndex, allExtends = this.allExtendsStack[this.allExtendsStack.length-1],
|
|
230
|
+
var matches, pathIndex, extendIndex, allExtends = this.allExtendsStack[this.allExtendsStack.length - 1],
|
|
231
|
+
selectorsToAdd = [], extendVisitor = this, selectorPath;
|
|
228
232
|
|
|
229
233
|
// look at each selector path in the ruleset, find any extend matches and then copy, find and replace
|
|
230
234
|
|
|
@@ -234,7 +238,7 @@ ProcessExtendsVisitor.prototype = {
|
|
|
234
238
|
|
|
235
239
|
// extending extends happens initially, before the main pass
|
|
236
240
|
if (rulesetNode.extendOnEveryPath) { continue; }
|
|
237
|
-
var extendList = selectorPath[selectorPath.length-1].extendList;
|
|
241
|
+
var extendList = selectorPath[selectorPath.length - 1].extendList;
|
|
238
242
|
if (extendList && extendList.length) { continue; }
|
|
239
243
|
|
|
240
244
|
matches = this.findMatch(allExtends[extendIndex], selectorPath);
|
|
@@ -271,15 +275,16 @@ ProcessExtendsVisitor.prototype = {
|
|
|
271
275
|
|
|
272
276
|
// if we allow elements before our match we can add a potential match every time. otherwise only at the first element.
|
|
273
277
|
if (extend.allowBefore || (haystackSelectorIndex === 0 && hackstackElementIndex === 0)) {
|
|
274
|
-
potentialMatches.push({pathIndex: haystackSelectorIndex, index: hackstackElementIndex, matched: 0,
|
|
278
|
+
potentialMatches.push({pathIndex: haystackSelectorIndex, index: hackstackElementIndex, matched: 0,
|
|
279
|
+
initialCombinator: haystackElement.combinator});
|
|
275
280
|
}
|
|
276
281
|
|
|
277
282
|
for(i = 0; i < potentialMatches.length; i++) {
|
|
278
283
|
potentialMatch = potentialMatches[i];
|
|
279
284
|
|
|
280
285
|
// selectors add " " onto the first element. When we use & it joins the selectors together, but if we don't
|
|
281
|
-
// then each selector in haystackSelectorPath has a space before it added in the toCSS phase. so we need to
|
|
282
|
-
// what the resulting combinator will be
|
|
286
|
+
// then each selector in haystackSelectorPath has a space before it added in the toCSS phase. so we need to
|
|
287
|
+
// work out what the resulting combinator will be
|
|
283
288
|
targetCombinator = haystackElement.combinator.value;
|
|
284
289
|
if (targetCombinator === '' && hackstackElementIndex === 0) {
|
|
285
290
|
targetCombinator = ' ';
|
|
@@ -297,7 +302,8 @@ ProcessExtendsVisitor.prototype = {
|
|
|
297
302
|
if (potentialMatch) {
|
|
298
303
|
potentialMatch.finished = potentialMatch.matched === needleElements.length;
|
|
299
304
|
if (potentialMatch.finished &&
|
|
300
|
-
(!extend.allowAfter &&
|
|
305
|
+
(!extend.allowAfter &&
|
|
306
|
+
(hackstackElementIndex + 1 < hackstackSelector.elements.length || haystackSelectorIndex + 1 < haystackSelectorPath.length))) {
|
|
301
307
|
potentialMatch = null;
|
|
302
308
|
}
|
|
303
309
|
}
|
|
@@ -343,7 +349,7 @@ ProcessExtendsVisitor.prototype = {
|
|
|
343
349
|
if (!(elementValue2 instanceof tree.Selector) || elementValue1.elements.length !== elementValue2.elements.length) {
|
|
344
350
|
return false;
|
|
345
351
|
}
|
|
346
|
-
for(var i = 0; i
|
|
352
|
+
for(var i = 0; i < elementValue1.elements.length; i++) {
|
|
347
353
|
if (elementValue1.elements[i].combinator.value !== elementValue2.elements[i].combinator.value) {
|
|
348
354
|
if (i !== 0 || (elementValue1.elements[i].combinator.value || ' ') !== (elementValue2.elements[i].combinator.value || ' ')) {
|
|
349
355
|
return false;
|
|
@@ -381,7 +387,8 @@ ProcessExtendsVisitor.prototype = {
|
|
|
381
387
|
);
|
|
382
388
|
|
|
383
389
|
if (match.pathIndex > currentSelectorPathIndex && currentSelectorPathElementIndex > 0) {
|
|
384
|
-
path[path.length - 1].elements = path[path.length - 1]
|
|
390
|
+
path[path.length - 1].elements = path[path.length - 1]
|
|
391
|
+
.elements.concat(selectorPath[currentSelectorPathIndex].elements.slice(currentSelectorPathElementIndex));
|
|
385
392
|
currentSelectorPathElementIndex = 0;
|
|
386
393
|
currentSelectorPathIndex++;
|
|
387
394
|
}
|
|
@@ -410,7 +417,8 @@ ProcessExtendsVisitor.prototype = {
|
|
|
410
417
|
}
|
|
411
418
|
|
|
412
419
|
if (currentSelectorPathIndex < selectorPath.length && currentSelectorPathElementIndex > 0) {
|
|
413
|
-
path[path.length - 1].elements = path[path.length - 1]
|
|
420
|
+
path[path.length - 1].elements = path[path.length - 1]
|
|
421
|
+
.elements.concat(selectorPath[currentSelectorPathIndex].elements.slice(currentSelectorPathElementIndex));
|
|
414
422
|
currentSelectorPathIndex++;
|
|
415
423
|
}
|
|
416
424
|
|
|
@@ -421,7 +429,7 @@ ProcessExtendsVisitor.prototype = {
|
|
|
421
429
|
visitRulesetOut: function (rulesetNode) {
|
|
422
430
|
},
|
|
423
431
|
visitMedia: function (mediaNode, visitArgs) {
|
|
424
|
-
var newAllExtends = mediaNode.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length-1]);
|
|
432
|
+
var newAllExtends = mediaNode.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length - 1]);
|
|
425
433
|
newAllExtends = newAllExtends.concat(this.doExtendChaining(newAllExtends, mediaNode.allExtends));
|
|
426
434
|
this.allExtendsStack.push(newAllExtends);
|
|
427
435
|
},
|
|
@@ -431,7 +439,7 @@ ProcessExtendsVisitor.prototype = {
|
|
|
431
439
|
this.allExtendsStack.length = lastIndex;
|
|
432
440
|
},
|
|
433
441
|
visitDirective: function (directiveNode, visitArgs) {
|
|
434
|
-
var newAllExtends = directiveNode.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length-1]);
|
|
442
|
+
var newAllExtends = directiveNode.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length - 1]);
|
|
435
443
|
newAllExtends = newAllExtends.concat(this.doExtendChaining(newAllExtends, directiveNode.allExtends));
|
|
436
444
|
this.allExtendsStack.push(newAllExtends);
|
|
437
445
|
},
|
|
@@ -84,7 +84,8 @@ ImportVisitor.prototype = {
|
|
|
84
84
|
var onImported = this.onImported.bind(this, evaldImportNode, context),
|
|
85
85
|
sequencedOnImported = this._sequencer.addImport(onImported);
|
|
86
86
|
|
|
87
|
-
this._importer.push(evaldImportNode.getPath(), tryAppendLessExtension, evaldImportNode.currentFileInfo,
|
|
87
|
+
this._importer.push(evaldImportNode.getPath(), tryAppendLessExtension, evaldImportNode.currentFileInfo,
|
|
88
|
+
evaldImportNode.options, sequencedOnImported);
|
|
88
89
|
} else {
|
|
89
90
|
this.importCount--;
|
|
90
91
|
if (this.isFinished) {
|
|
@@ -55,7 +55,7 @@ ToCSSVisitor.prototype = {
|
|
|
55
55
|
// be considered illegal css as it has to be on the first line
|
|
56
56
|
if (this.charset) {
|
|
57
57
|
if (directiveNode.debugInfo) {
|
|
58
|
-
var comment = new tree.Comment("/* " + directiveNode.toCSS(this._context).replace(/\n/g, "")+" */\n");
|
|
58
|
+
var comment = new tree.Comment("/* " + directiveNode.toCSS(this._context).replace(/\n/g, "") + " */\n");
|
|
59
59
|
comment.debugInfo = directiveNode.debugInfo;
|
|
60
60
|
return this._visitor.visit(comment);
|
|
61
61
|
}
|
|
@@ -79,7 +79,7 @@ ToCSSVisitor.prototype = {
|
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
//the directive was not directly referenced
|
|
82
|
-
for (var r = 0; r<directiveNode.rules.rules.length; r++) {
|
|
82
|
+
for (var r = 0; r < directiveNode.rules.rules.length; r++) {
|
|
83
83
|
var rule = directiveNode.rules.rules[r];
|
|
84
84
|
if (rule.getIsReferenced && rule.getIsReferenced()) {
|
|
85
85
|
//the directive contains something that was referenced (likely by extend)
|
|
@@ -94,8 +94,9 @@ ToCSSVisitor.prototype = {
|
|
|
94
94
|
//was referenced. Therefore it must not be shown in output.
|
|
95
95
|
return ;
|
|
96
96
|
} else {
|
|
97
|
-
if (!directiveNode.getIsReferenced())
|
|
97
|
+
if (!directiveNode.getIsReferenced()) {
|
|
98
98
|
return;
|
|
99
|
+
}
|
|
99
100
|
}
|
|
100
101
|
return directiveNode;
|
|
101
102
|
},
|
|
@@ -256,7 +257,7 @@ ToCSSVisitor.prototype = {
|
|
|
256
257
|
var spacedGroups = [];
|
|
257
258
|
var lastSpacedGroup = [];
|
|
258
259
|
parts.map(function (p) {
|
|
259
|
-
if (p.merge==="+") {
|
|
260
|
+
if (p.merge === "+") {
|
|
260
261
|
if (lastSpacedGroup.length > 0) {
|
|
261
262
|
spacedGroups.push(toExpression(lastSpacedGroup));
|
|
262
263
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
module.exports = {
|
|
2
2
|
extractId: function(href) {
|
|
3
3
|
return href.replace(/^[a-z-]+:\/+?[^\/]+/, '' ) // Remove protocol & domain
|
|
4
|
-
.replace(/[\?\&]livereload=\w+/,'' ) // Remove LiveReload cachebuster
|
|
5
|
-
.replace(/^\//,
|
|
6
|
-
.replace(/\.[a-zA-Z]+$/,
|
|
7
|
-
.replace(/[^\.\w-]+/g,
|
|
8
|
-
.replace(/\./g,
|
|
4
|
+
.replace(/[\?\&]livereload=\w+/, '' ) // Remove LiveReload cachebuster
|
|
5
|
+
.replace(/^\//, '' ) // Remove root /
|
|
6
|
+
.replace(/\.[a-zA-Z]+$/, '' ) // Remove simple extension
|
|
7
|
+
.replace(/[^\.\w-]+/g, '-') // Replace illegal characters
|
|
8
|
+
.replace(/\./g, ':'); // Replace dots with colons(for valid id)
|
|
9
9
|
},
|
|
10
10
|
addDataAttr: function(options, tag) {
|
|
11
11
|
for (var opt in tag.dataset) {
|
|
@@ -30,7 +30,7 @@ FileManager.prototype.loadFile = function(filename, currentDirectory, options, e
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
var paths = isAbsoluteFilename ? [""] : [currentDirectory];
|
|
33
|
-
if (options.paths) paths.push.apply(paths, options.paths);
|
|
33
|
+
if (options.paths) { paths.push.apply(paths, options.paths); }
|
|
34
34
|
if (!isAbsoluteFilename && paths.indexOf('.') === -1) { paths.push('.'); }
|
|
35
35
|
|
|
36
36
|
// promise is guarenteed to be asyncronous
|
|
@@ -63,12 +63,16 @@ FileManager.prototype.loadFile = function(filename, currentDirectory, options, e
|
|
|
63
63
|
};
|
|
64
64
|
|
|
65
65
|
FileManager.prototype.loadFileSync = function(filename, currentDirectory, options, environment, encoding) {
|
|
66
|
-
var fullFilename, paths, filenamesTried=[], isAbsoluteFilename = this.isPathAbsolute(filename),data;
|
|
66
|
+
var fullFilename, paths, filenamesTried = [], isAbsoluteFilename = this.isPathAbsolute(filename) , data;
|
|
67
67
|
options = options || {};
|
|
68
68
|
|
|
69
69
|
paths = isAbsoluteFilename ? [""] : [currentDirectory];
|
|
70
|
-
if (options.paths)
|
|
71
|
-
|
|
70
|
+
if (options.paths) {
|
|
71
|
+
paths.push.apply(paths, options.paths);
|
|
72
|
+
}
|
|
73
|
+
if (!isAbsoluteFilename && paths.indexOf('.') === -1) {
|
|
74
|
+
paths.push('.');
|
|
75
|
+
}
|
|
72
76
|
|
|
73
77
|
var err, result;
|
|
74
78
|
for (var i = 0; i < paths.length; i++) {
|
|
@@ -35,7 +35,7 @@ UrlFileManager.prototype.loadFile = function(filename, currentDirectory, options
|
|
|
35
35
|
|
|
36
36
|
request.get({uri: urlStr, strictSSL: !options.insecure }, function (error, res, body) {
|
|
37
37
|
if (error) {
|
|
38
|
-
reject({ type: 'File', message: "resource '" + urlStr + "' gave this Error:\n "+ error +"\n" });
|
|
38
|
+
reject({ type: 'File', message: "resource '" + urlStr + "' gave this Error:\n " + error + "\n" });
|
|
39
39
|
return;
|
|
40
40
|
}
|
|
41
41
|
if (res && res.statusCode === 404) {
|
|
@@ -43,7 +43,7 @@ UrlFileManager.prototype.loadFile = function(filename, currentDirectory, options
|
|
|
43
43
|
return;
|
|
44
44
|
}
|
|
45
45
|
if (!body) {
|
|
46
|
-
logger.warn('Warning: Empty body (HTTP '+ res.statusCode + ') returned by "' + urlStr +'"');
|
|
46
|
+
logger.warn('Warning: Empty body (HTTP '+ res.statusCode + ') returned by "' + urlStr + '"');
|
|
47
47
|
}
|
|
48
48
|
fulfill({ contents: body, filename: urlStr });
|
|
49
49
|
});
|
package/lib/less-rhino/index.js
CHANGED
|
@@ -114,7 +114,7 @@ less.Parser.fileLoader = function (file, currentFileInfo, callback, env) {
|
|
|
114
114
|
|
|
115
115
|
var j = file.lastIndexOf('/');
|
|
116
116
|
if(newFileInfo.relativeUrls && !/^(?:[a-z-]+:|\/)/.test(file) && j != -1) {
|
|
117
|
-
var relativeSubDirectory = file.slice(0, j+1);
|
|
117
|
+
var relativeSubDirectory = file.slice(0, j + 1);
|
|
118
118
|
newFileInfo.rootpath = newFileInfo.rootpath + relativeSubDirectory; // append (sub|sup) directory path of imported file
|
|
119
119
|
}
|
|
120
120
|
newFileInfo.currentDirectory = path;
|
|
@@ -177,7 +177,7 @@ function writeFile(filename, content) {
|
|
|
177
177
|
var checkBooleanArg = function(arg) {
|
|
178
178
|
var onOff = /^((on|t|true|y|yes)|(off|f|false|n|no))$/i.exec(arg);
|
|
179
179
|
if (!onOff) {
|
|
180
|
-
print(" unable to parse "+arg+" as a boolean. use one of on/t/true/y/yes/off/f/false/n/no");
|
|
180
|
+
print(" unable to parse " + arg + " as a boolean. use one of on/t/true/y/yes/off/f/false/n/no");
|
|
181
181
|
continueProcessing = false;
|
|
182
182
|
return false;
|
|
183
183
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "less",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.1",
|
|
4
4
|
"description": "Leaner CSS",
|
|
5
5
|
"homepage": "http://lesscss.org",
|
|
6
6
|
"author": {
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"mkdirp": "^0.5.0",
|
|
48
48
|
"promise": "^6.0.1",
|
|
49
49
|
"request": "^2.51.0",
|
|
50
|
-
"source-map": "^0.
|
|
50
|
+
"source-map": "^0.2.0"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"diff": "^1.0",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"grunt-contrib-concat": "^0.5.0",
|
|
57
57
|
"grunt-contrib-connect": "^0.9.0",
|
|
58
58
|
"grunt-contrib-jasmine": "^0.8.1",
|
|
59
|
-
"grunt-contrib-jshint": "^0.
|
|
59
|
+
"grunt-contrib-jshint": "^0.11.0",
|
|
60
60
|
"grunt-contrib-uglify": "^0.7.0",
|
|
61
61
|
"grunt-jscs": "^1.2.0",
|
|
62
62
|
"grunt-shell": "^1.1.1",
|
package/test/browser/common.js
CHANGED
|
@@ -130,10 +130,10 @@ var testErrorSheet = function (sheet) {
|
|
|
130
130
|
.replace(/<h3>|<\/?p>|<a href="[^"]*">|<\/a>|<ul>|<\/?pre( class="?[^">]*"?)?>|<\/li>|<\/?label>/ig, "")
|
|
131
131
|
.replace(/<\/h3>/ig, " ")
|
|
132
132
|
.replace(/<li>|<\/ul>|<br>/ig, "\n"))
|
|
133
|
-
.replace(/&/ig,"&")
|
|
133
|
+
.replace(/&/ig, "&")
|
|
134
134
|
// for IE8
|
|
135
|
-
.replace(/\r\n/g,"\n")
|
|
136
|
-
.replace(/\. \nin/,". in");
|
|
135
|
+
.replace(/\r\n/g, "\n")
|
|
136
|
+
.replace(/\. \nin/, ". in");
|
|
137
137
|
actualErrorMsg = innerText
|
|
138
138
|
.replace(/\n\d+/g, function (lineNo) {
|
|
139
139
|
return lineNo + " ";
|
|
@@ -239,7 +239,7 @@
|
|
|
239
239
|
suite.specs = [];
|
|
240
240
|
suite.suites = [];
|
|
241
241
|
suite.passed = true;
|
|
242
|
-
suite.parentId = this.suiteStack.slice(this.suiteStack.length -1)[0];
|
|
242
|
+
suite.parentId = this.suiteStack.slice(this.suiteStack.length - 1)[0];
|
|
243
243
|
if (suite.parentId) {
|
|
244
244
|
this.suites[suite.parentId].suites.push(suite);
|
|
245
245
|
} else {
|
|
@@ -272,7 +272,7 @@
|
|
|
272
272
|
spec = this._cacheSpec(spec);
|
|
273
273
|
spec.timer = new Timer().start();
|
|
274
274
|
// build up suites->spec tree as we go
|
|
275
|
-
spec.suiteId = this.suiteStack.slice(this.suiteStack.length -1)[0];
|
|
275
|
+
spec.suiteId = this.suiteStack.slice(this.suiteStack.length - 1)[0];
|
|
276
276
|
this.suites[spec.suiteId].specs.push(spec);
|
|
277
277
|
};
|
|
278
278
|
|