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.
Files changed (268) hide show
  1. package/.idea/inspectionProfiles/Project_Default.xml +1 -0
  2. package/.idea/jsLinters/jscs.xml +4 -0
  3. package/.idea/jsLinters/jshint.xml +58 -4
  4. package/.idea/workspace.xml +427 -892
  5. package/.jscsrc +34 -2
  6. package/.jshintrc +0 -1
  7. package/CHANGELOG.md +7 -0
  8. package/bin/lessc +8 -3
  9. package/bower.json +1 -1
  10. package/dist/less.js +362 -245
  11. package/dist/less.min.js +5 -5
  12. package/lib/less/data/unit-conversions.js +3 -3
  13. package/lib/less/environment/abstract-file-manager.js +4 -4
  14. package/lib/less/functions/color-blending.js +3 -3
  15. package/lib/less/functions/color.js +7 -7
  16. package/lib/less/functions/data-uri.js +3 -2
  17. package/lib/less/functions/string.js +3 -1
  18. package/lib/less/functions/svg.js +6 -3
  19. package/lib/less/functions/types.js +3 -1
  20. package/lib/less/import-manager.js +4 -1
  21. package/lib/less/index.js +1 -1
  22. package/lib/less/parser/parser.js +12 -7
  23. package/lib/less/source-map-output.js +3 -3
  24. package/lib/less/transform-tree.js +1 -1
  25. package/lib/less/tree/condition.js +1 -1
  26. package/lib/less/tree/debug-info.js +6 -2
  27. package/lib/less/tree/dimension.js +1 -1
  28. package/lib/less/tree/directive.js +15 -3
  29. package/lib/less/tree/import.js +1 -1
  30. package/lib/less/tree/media.js +3 -2
  31. package/lib/less/tree/mixin-call.js +3 -4
  32. package/lib/less/tree/mixin-definition.js +4 -3
  33. package/lib/less/tree/quoted.js +1 -1
  34. package/lib/less/tree/rule.js +2 -3
  35. package/lib/less/tree/ruleset.js +223 -149
  36. package/lib/less/tree/selector.js +2 -1
  37. package/lib/less/tree/url.js +1 -1
  38. package/lib/less/tree/value.js +1 -1
  39. package/lib/less/tree/variable.js +1 -1
  40. package/lib/less/visitors/extend-visitor.js +30 -22
  41. package/lib/less/visitors/import-visitor.js +2 -1
  42. package/lib/less/visitors/to-css-visitor.js +5 -4
  43. package/lib/less-browser/utils.js +5 -5
  44. package/lib/less-node/file-manager.js +8 -4
  45. package/lib/less-node/url-file-manager.js +2 -2
  46. package/lib/less-rhino/index.js +2 -2
  47. package/package.json +3 -3
  48. package/test/browser/common.js +3 -3
  49. package/test/browser/jasmine-jsreporter.js +2 -2
  50. package/test/browser/less.js +29 -0
  51. package/test/copy-bom.js +14 -8
  52. package/test/css/selectors.css +9 -0
  53. package/test/index.js +1 -1
  54. package/test/less/selectors.less +18 -3
  55. package/test/less-bom/charsets.less +3 -0
  56. package/test/less-bom/colors.less +98 -0
  57. package/test/less-bom/comments.less +102 -0
  58. package/test/less-bom/comments2.less +20 -0
  59. package/test/less-bom/compression/compression.less +36 -0
  60. package/test/less-bom/css-3.less +154 -0
  61. package/test/less-bom/css-escapes.less +33 -0
  62. package/test/less-bom/css-guards.less +103 -0
  63. package/test/less-bom/css.less +108 -0
  64. package/test/less-bom/debug/import/test.less +25 -0
  65. package/test/less-bom/debug/linenumbers.less +33 -0
  66. package/test/less-bom/detached-rulesets.less +103 -0
  67. package/test/less-bom/empty.less +1 -0
  68. package/test/less-bom/errors/add-mixed-units.less +3 -0
  69. package/test/less-bom/errors/add-mixed-units.txt +4 -0
  70. package/test/less-bom/errors/add-mixed-units2.less +3 -0
  71. package/test/less-bom/errors/add-mixed-units2.txt +4 -0
  72. package/test/less-bom/errors/at-rules-undefined-var.less +4 -0
  73. package/test/less-bom/errors/at-rules-undefined-var.txt +4 -0
  74. package/test/less-bom/errors/bad-variable-declaration1.less +1 -0
  75. package/test/less-bom/errors/bad-variable-declaration1.txt +2 -0
  76. package/test/less-bom/errors/color-func-invalid-color.less +3 -0
  77. package/test/less-bom/errors/color-func-invalid-color.txt +4 -0
  78. package/test/less-bom/errors/color-invalid-hex-code.less +3 -0
  79. package/test/less-bom/errors/color-invalid-hex-code.txt +4 -0
  80. package/test/less-bom/errors/color-invalid-hex-code2.less +3 -0
  81. package/test/less-bom/errors/color-invalid-hex-code2.txt +4 -0
  82. package/test/less-bom/errors/css-guard-default-func.less +4 -0
  83. package/test/less-bom/errors/css-guard-default-func.txt +4 -0
  84. package/test/less-bom/errors/detached-ruleset-1.less +6 -0
  85. package/test/less-bom/errors/detached-ruleset-1.txt +4 -0
  86. package/test/less-bom/errors/detached-ruleset-2.less +6 -0
  87. package/test/less-bom/errors/detached-ruleset-2.txt +4 -0
  88. package/test/less-bom/errors/detached-ruleset-3.less +4 -0
  89. package/test/less-bom/errors/detached-ruleset-3.txt +4 -0
  90. package/test/less-bom/errors/detached-ruleset-4.less +5 -0
  91. package/test/less-bom/errors/detached-ruleset-4.txt +4 -0
  92. package/test/less-bom/errors/detached-ruleset-5.less +4 -0
  93. package/test/less-bom/errors/detached-ruleset-5.txt +3 -0
  94. package/test/less-bom/errors/detached-ruleset-6.less +5 -0
  95. package/test/less-bom/errors/detached-ruleset-6.txt +4 -0
  96. package/test/less-bom/errors/divide-mixed-units.less +3 -0
  97. package/test/less-bom/errors/divide-mixed-units.txt +4 -0
  98. package/test/less-bom/errors/extend-no-selector.less +3 -0
  99. package/test/less-bom/errors/extend-no-selector.txt +3 -0
  100. package/test/less-bom/errors/extend-not-at-end.less +3 -0
  101. package/test/less-bom/errors/extend-not-at-end.txt +3 -0
  102. package/test/less-bom/errors/import-malformed.less +1 -0
  103. package/test/less-bom/errors/import-malformed.txt +3 -0
  104. package/test/less-bom/errors/import-missing.less +6 -0
  105. package/test/less-bom/errors/import-missing.txt +3 -0
  106. package/test/less-bom/errors/import-no-semi.less +1 -0
  107. package/test/less-bom/errors/import-no-semi.txt +2 -0
  108. package/test/less-bom/errors/import-subfolder1.less +1 -0
  109. package/test/less-bom/errors/import-subfolder1.txt +3 -0
  110. package/test/less-bom/errors/import-subfolder2.less +1 -0
  111. package/test/less-bom/errors/import-subfolder2.txt +4 -0
  112. package/test/less-bom/errors/imports/import-subfolder1.less +1 -0
  113. package/test/less-bom/errors/imports/import-subfolder2.less +1 -0
  114. package/test/less-bom/errors/imports/import-test.less +4 -0
  115. package/test/less-bom/errors/imports/subfolder/mixin-not-defined.less +1 -0
  116. package/test/less-bom/errors/imports/subfolder/parse-error-curly-bracket.less +1 -0
  117. package/test/less-bom/errors/javascript-error.less +3 -0
  118. package/test/less-bom/errors/javascript-error.txt +4 -0
  119. package/test/less-bom/errors/javascript-undefined-var.less +3 -0
  120. package/test/less-bom/errors/javascript-undefined-var.txt +4 -0
  121. package/test/less-bom/errors/mixed-mixin-definition-args-1.less +6 -0
  122. package/test/less-bom/errors/mixed-mixin-definition-args-1.txt +4 -0
  123. package/test/less-bom/errors/mixed-mixin-definition-args-2.less +6 -0
  124. package/test/less-bom/errors/mixed-mixin-definition-args-2.txt +4 -0
  125. package/test/less-bom/errors/mixin-not-defined.less +11 -0
  126. package/test/less-bom/errors/mixin-not-defined.txt +3 -0
  127. package/test/less-bom/errors/mixin-not-matched.less +6 -0
  128. package/test/less-bom/errors/mixin-not-matched.txt +3 -0
  129. package/test/less-bom/errors/mixin-not-matched2.less +6 -0
  130. package/test/less-bom/errors/mixin-not-matched2.txt +3 -0
  131. package/test/less-bom/errors/mixin-not-visible-in-scope-1.less +9 -0
  132. package/test/less-bom/errors/mixin-not-visible-in-scope-1.txt +4 -0
  133. package/test/less-bom/errors/mixins-guards-default-func-1.less +9 -0
  134. package/test/less-bom/errors/mixins-guards-default-func-1.txt +4 -0
  135. package/test/less-bom/errors/mixins-guards-default-func-2.less +9 -0
  136. package/test/less-bom/errors/mixins-guards-default-func-2.txt +4 -0
  137. package/test/less-bom/errors/mixins-guards-default-func-3.less +9 -0
  138. package/test/less-bom/errors/mixins-guards-default-func-3.txt +4 -0
  139. package/test/less-bom/errors/multiple-guards-on-css-selectors.less +4 -0
  140. package/test/less-bom/errors/multiple-guards-on-css-selectors.txt +4 -0
  141. package/test/less-bom/errors/multiple-guards-on-css-selectors2.less +4 -0
  142. package/test/less-bom/errors/multiple-guards-on-css-selectors2.txt +4 -0
  143. package/test/less-bom/errors/multiply-mixed-units.less +7 -0
  144. package/test/less-bom/errors/multiply-mixed-units.txt +4 -0
  145. package/test/less-bom/errors/parens-error-1.less +3 -0
  146. package/test/less-bom/errors/parens-error-1.txt +4 -0
  147. package/test/less-bom/errors/parens-error-2.less +3 -0
  148. package/test/less-bom/errors/parens-error-2.txt +4 -0
  149. package/test/less-bom/errors/parens-error-3.less +3 -0
  150. package/test/less-bom/errors/parens-error-3.txt +4 -0
  151. package/test/less-bom/errors/parse-error-curly-bracket.less +4 -0
  152. package/test/less-bom/errors/parse-error-curly-bracket.txt +4 -0
  153. package/test/less-bom/errors/parse-error-extra-parens.less +5 -0
  154. package/test/less-bom/errors/parse-error-extra-parens.txt +3 -0
  155. package/test/less-bom/errors/parse-error-missing-bracket.less +2 -0
  156. package/test/less-bom/errors/parse-error-missing-bracket.txt +3 -0
  157. package/test/less-bom/errors/parse-error-missing-parens.less +5 -0
  158. package/test/less-bom/errors/parse-error-missing-parens.txt +3 -0
  159. package/test/less-bom/errors/parse-error-with-import.less +13 -0
  160. package/test/less-bom/errors/parse-error-with-import.txt +4 -0
  161. package/test/less-bom/errors/percentage-missing-space.less +3 -0
  162. package/test/less-bom/errors/percentage-missing-space.txt +4 -0
  163. package/test/less-bom/errors/property-asterisk-only-name.less +3 -0
  164. package/test/less-bom/errors/property-asterisk-only-name.txt +4 -0
  165. package/test/less-bom/errors/property-ie5-hack.less +3 -0
  166. package/test/less-bom/errors/property-ie5-hack.txt +3 -0
  167. package/test/less-bom/errors/property-in-root.less +4 -0
  168. package/test/less-bom/errors/property-in-root.txt +4 -0
  169. package/test/less-bom/errors/property-in-root2.less +1 -0
  170. package/test/less-bom/errors/property-in-root2.txt +4 -0
  171. package/test/less-bom/errors/property-in-root3.less +4 -0
  172. package/test/less-bom/errors/property-in-root3.txt +3 -0
  173. package/test/less-bom/errors/property-interp-not-defined.less +1 -0
  174. package/test/less-bom/errors/property-interp-not-defined.txt +2 -0
  175. package/test/less-bom/errors/recursive-variable.less +1 -0
  176. package/test/less-bom/errors/recursive-variable.txt +2 -0
  177. package/test/less-bom/errors/single-character.less +1 -0
  178. package/test/less-bom/errors/single-character.txt +2 -0
  179. package/test/less-bom/errors/svg-gradient1.less +3 -0
  180. package/test/less-bom/errors/svg-gradient1.txt +4 -0
  181. package/test/less-bom/errors/svg-gradient2.less +3 -0
  182. package/test/less-bom/errors/svg-gradient2.txt +4 -0
  183. package/test/less-bom/errors/svg-gradient3.less +3 -0
  184. package/test/less-bom/errors/svg-gradient3.txt +4 -0
  185. package/test/less-bom/errors/unit-function.less +3 -0
  186. package/test/less-bom/errors/unit-function.txt +4 -0
  187. package/test/less-bom/extend-chaining.less +91 -0
  188. package/test/less-bom/extend-clearfix.less +19 -0
  189. package/test/less-bom/extend-exact.less +46 -0
  190. package/test/less-bom/extend-media.less +24 -0
  191. package/test/less-bom/extend-nest.less +65 -0
  192. package/test/less-bom/extend-selector.less +99 -0
  193. package/test/less-bom/extend.less +81 -0
  194. package/test/less-bom/extract-and-length.less +133 -0
  195. package/test/less-bom/functions.less +201 -0
  196. package/test/less-bom/globalVars/extended.json +5 -0
  197. package/test/less-bom/globalVars/extended.less +10 -0
  198. package/test/less-bom/globalVars/simple.json +3 -0
  199. package/test/less-bom/globalVars/simple.less +3 -0
  200. package/test/less-bom/ie-filters.less +15 -0
  201. package/test/less-bom/import/deeper/deeper-2/url-import-2.less +3 -0
  202. package/test/less-bom/import/deeper/deeper-2/url-import.less +1 -0
  203. package/test/less-bom/import/deeper/import-once-test-a.less +1 -0
  204. package/test/less-bom/import/deeper/url-import.less +1 -0
  205. package/test/less-bom/import/import-and-relative-paths-test.less +17 -0
  206. package/test/less-bom/import/import-charset-test.less +1 -0
  207. package/test/less-bom/import/import-interpolation.less +2 -0
  208. package/test/less-bom/import/import-interpolation2.less +5 -0
  209. package/test/less-bom/import/import-once-test-c.less +6 -0
  210. package/test/less-bom/import/import-reference.less +89 -0
  211. package/test/less-bom/import/import-test-a.less +4 -0
  212. package/test/less-bom/import/import-test-b.less +8 -0
  213. package/test/less-bom/import/import-test-c.less +6 -0
  214. package/test/less-bom/import/import-test-d.css +1 -0
  215. package/test/less-bom/import/import-test-e.less +2 -0
  216. package/test/less-bom/import/import-test-f.less +5 -0
  217. package/test/less-bom/import/imports/font.less +8 -0
  218. package/test/less-bom/import/imports/logo.less +5 -0
  219. package/test/less-bom/import/interpolation-vars.less +6 -0
  220. package/test/less-bom/import/invalid-css.less +1 -0
  221. package/test/less-bom/import/urls.less +1 -0
  222. package/test/less-bom/import-inline.less +3 -0
  223. package/test/less-bom/import-interpolation.less +8 -0
  224. package/test/less-bom/import-once.less +6 -0
  225. package/test/less-bom/import-reference.less +23 -0
  226. package/test/less-bom/import.less +30 -0
  227. package/test/less-bom/include-path/include-path.less +6 -0
  228. package/test/less-bom/javascript.less +38 -0
  229. package/test/less-bom/lazy-eval.less +6 -0
  230. package/test/less-bom/legacy/legacy.less +7 -0
  231. package/test/less-bom/media.less +234 -0
  232. package/test/less-bom/merge.less +78 -0
  233. package/test/less-bom/mixins-args.less +215 -0
  234. package/test/less-bom/mixins-closure.less +26 -0
  235. package/test/less-bom/mixins-guards-default-func.less +195 -0
  236. package/test/less-bom/mixins-guards.less +271 -0
  237. package/test/less-bom/mixins-important.less +37 -0
  238. package/test/less-bom/mixins-interpolated.less +75 -0
  239. package/test/less-bom/mixins-named-args.less +36 -0
  240. package/test/less-bom/mixins-nested.less +22 -0
  241. package/test/less-bom/mixins-pattern.less +102 -0
  242. package/test/less-bom/mixins.less +145 -0
  243. package/test/less-bom/modifyVars/extended.json +5 -0
  244. package/test/less-bom/modifyVars/extended.less +11 -0
  245. package/test/less-bom/nested-gradient-with-svg-gradient/mixin-consumer.less +5 -0
  246. package/test/less-bom/nested-gradient-with-svg-gradient/svg-gradient-mixin.less +15 -0
  247. package/test/less-bom/no-js-errors/no-js-errors.less +3 -0
  248. package/test/less-bom/no-js-errors/no-js-errors.txt +4 -0
  249. package/test/less-bom/no-output.less +2 -0
  250. package/test/less-bom/operations.less +62 -0
  251. package/test/less-bom/parens.less +45 -0
  252. package/test/less-bom/property-name-interp.less +56 -0
  253. package/test/less-bom/rulesets.less +30 -0
  254. package/test/less-bom/scope.less +104 -0
  255. package/test/less-bom/selectors.less +174 -0
  256. package/test/less-bom/sourcemaps/basic.json +3 -0
  257. package/test/less-bom/sourcemaps/basic.less +27 -0
  258. package/test/less-bom/sourcemaps/imported.css +7 -0
  259. package/test/less-bom/static-urls/urls.less +33 -0
  260. package/test/less-bom/strict-units/strict-units.less +4 -0
  261. package/test/less-bom/strings.less +73 -0
  262. package/test/less-bom/url-args/urls.less +63 -0
  263. package/test/less-bom/urls.less +94 -0
  264. package/test/less-bom/variables-in-at-rules.less +20 -0
  265. package/test/less-bom/variables.less +119 -0
  266. package/test/less-bom/whitespace.less +44 -0
  267. package/test/less-test.js +2 -2
  268. package/test/modify-vars.js +6 -4
package/dist/less.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Less - Leaner CSS v2.3.0
2
+ * Less - Leaner CSS v2.3.1
3
3
  * http://lesscss.org
4
4
  *
5
5
  * Copyright (c) 2009-2015, Alexis Sellier <self@cloudhead.net>
@@ -788,11 +788,11 @@ module.exports = function(less, options) {
788
788
  module.exports = {
789
789
  extractId: function(href) {
790
790
  return href.replace(/^[a-z-]+:\/+?[^\/]+/, '' ) // Remove protocol & domain
791
- .replace(/[\?\&]livereload=\w+/,'' ) // Remove LiveReload cachebuster
792
- .replace(/^\//, '' ) // Remove root /
793
- .replace(/\.[a-zA-Z]+$/, '' ) // Remove simple extension
794
- .replace(/[^\.\w-]+/g, '-') // Replace illegal characters
795
- .replace(/\./g, ':'); // Replace dots with colons(for valid id)
791
+ .replace(/[\?\&]livereload=\w+/, '' ) // Remove LiveReload cachebuster
792
+ .replace(/^\//, '' ) // Remove root /
793
+ .replace(/\.[a-zA-Z]+$/, '' ) // Remove simple extension
794
+ .replace(/[^\.\w-]+/g, '-') // Replace illegal characters
795
+ .replace(/\./g, ':'); // Replace dots with colons(for valid id)
796
796
  },
797
797
  addDataAttr: function(options, tag) {
798
798
  for (var opt in tag.dataset) {
@@ -1095,9 +1095,9 @@ module.exports = {
1095
1095
  'ms': 0.001
1096
1096
  },
1097
1097
  angle: {
1098
- 'rad': 1/(2*Math.PI),
1099
- 'deg': 1/360,
1100
- 'grad': 1/400,
1098
+ 'rad': 1 / (2 * Math.PI),
1099
+ 'deg': 1 / 360,
1100
+ 'grad': 1 / 400,
1101
1101
  'turn': 1
1102
1102
  }
1103
1103
  };
@@ -1157,10 +1157,10 @@ abstractFileManager.prototype.pathDiff = function pathDiff(url, baseUrl) {
1157
1157
  }
1158
1158
  baseUrlDirectories = baseUrlParts.directories.slice(i);
1159
1159
  urlDirectories = urlParts.directories.slice(i);
1160
- for(i = 0; i < baseUrlDirectories.length-1; i++) {
1160
+ for(i = 0; i < baseUrlDirectories.length - 1; i++) {
1161
1161
  diff += "../";
1162
1162
  }
1163
- for(i = 0; i < urlDirectories.length-1; i++) {
1163
+ for(i = 0; i < urlDirectories.length - 1; i++) {
1164
1164
  diff += urlDirectories[i] + "/";
1165
1165
  }
1166
1166
  return diff;
@@ -1185,7 +1185,7 @@ abstractFileManager.prototype.extractUrlParts = function extractUrlParts(url, ba
1185
1185
  if (baseUrl && (!urlParts[1] || urlParts[2])) {
1186
1186
  baseUrlParts = baseUrl.match(urlPartsRegex);
1187
1187
  if (!baseUrlParts) {
1188
- throw new Error("Could not parse page url - '"+baseUrl+"'");
1188
+ throw new Error("Could not parse page url - '" + baseUrl + "'");
1189
1189
  }
1190
1190
  urlParts[1] = urlParts[1] || baseUrlParts[1] || "";
1191
1191
  if (!urlParts[2]) {
@@ -1206,7 +1206,7 @@ abstractFileManager.prototype.extractUrlParts = function extractUrlParts(url, ba
1206
1206
 
1207
1207
  for(i = 0; i < directories.length; i++) {
1208
1208
  if (directories[i] === ".." && i > 0) {
1209
- directories.splice(i-1, 2);
1209
+ directories.splice(i - 1, 2);
1210
1210
  i -= 2;
1211
1211
  }
1212
1212
  }
@@ -1311,9 +1311,9 @@ var colorBlendModeFunctions = {
1311
1311
  },
1312
1312
  overlay: function(cb, cs) {
1313
1313
  cb *= 2;
1314
- return (cb <= 1)
1315
- ? colorBlendModeFunctions.multiply(cb, cs)
1316
- : colorBlendModeFunctions.screen(cb - 1, cs);
1314
+ return (cb <= 1) ?
1315
+ colorBlendModeFunctions.multiply(cb, cs) :
1316
+ colorBlendModeFunctions.screen(cb - 1, cs);
1317
1317
  },
1318
1318
  softlight: function(cb, cs) {
1319
1319
  var d = 1, e = cb;
@@ -1401,7 +1401,7 @@ colorFunctions = {
1401
1401
  h = h < 0 ? h + 1 : (h > 1 ? h - 1 : h);
1402
1402
  if (h * 6 < 1) { return m1 + (m2 - m1) * h * 6; }
1403
1403
  else if (h * 2 < 1) { return m2; }
1404
- else if (h * 3 < 2) { return m1 + (m2 - m1) * (2/3 - h) * 6; }
1404
+ else if (h * 3 < 2) { return m1 + (m2 - m1) * (2 / 3 - h) * 6; }
1405
1405
  else { return m1; }
1406
1406
  }
1407
1407
 
@@ -1411,9 +1411,9 @@ colorFunctions = {
1411
1411
  var m2 = l <= 0.5 ? l * (s + 1) : l + s - l * s;
1412
1412
  var m1 = l * 2 - m2;
1413
1413
 
1414
- return colorFunctions.rgba(hue(h + 1/3) * 255,
1414
+ return colorFunctions.rgba(hue(h + 1 / 3) * 255,
1415
1415
  hue(h) * 255,
1416
- hue(h - 1/3) * 255,
1416
+ hue(h - 1 / 3) * 255,
1417
1417
  a);
1418
1418
  },
1419
1419
 
@@ -1481,9 +1481,9 @@ colorFunctions = {
1481
1481
  },
1482
1482
  luminance: function (color) {
1483
1483
  var luminance =
1484
- (0.2126 * color.rgb[0] / 255)
1485
- + (0.7152 * color.rgb[1] / 255)
1486
- + (0.0722 * color.rgb[2] / 255);
1484
+ (0.2126 * color.rgb[0] / 255) +
1485
+ (0.7152 * color.rgb[1] / 255) +
1486
+ (0.0722 * color.rgb[2] / 255);
1487
1487
 
1488
1488
  return new Dimension(luminance * color.alpha * 100, '%');
1489
1489
  },
@@ -1622,7 +1622,7 @@ colorFunctions = {
1622
1622
  };
1623
1623
  },
1624
1624
  tint: function(color, amount) {
1625
- return colorFunctions.mix(colorFunctions.rgb(255,255,255), color, amount);
1625
+ return colorFunctions.mix(colorFunctions.rgb(255, 255, 255), color, amount);
1626
1626
  },
1627
1627
  shade: function(color, amount) {
1628
1628
  return colorFunctions.mix(colorFunctions.rgb(0, 0, 0), color, amount);
@@ -1655,7 +1655,7 @@ module.exports = function(environment) {
1655
1655
 
1656
1656
  var fragmentStart = filePath.indexOf('#');
1657
1657
  var fragment = '';
1658
- if (fragmentStart!==-1) {
1658
+ if (fragmentStart !== -1) {
1659
1659
  fragment = filePath.slice(fragmentStart);
1660
1660
  filePath = filePath.slice(0, fragmentStart);
1661
1661
  }
@@ -1706,7 +1706,8 @@ module.exports = function(environment) {
1706
1706
  if (uri.length >= DATA_URI_MAX) {
1707
1707
 
1708
1708
  if (this.context.ieCompat !== false) {
1709
- logger.warn("Skipped data-uri embedding of " + filePath + " because its size (" + uri.length + " characters) exceeds IE8-safe " + DATA_URI_MAX + " characters!");
1709
+ logger.warn("Skipped data-uri embedding of " + filePath + " because its size (" + uri.length +
1710
+ " characters) exceeds IE8-safe " + DATA_URI_MAX + " characters!");
1710
1711
 
1711
1712
  return fallback(this, filePathNode || mimetypeNode);
1712
1713
  }
@@ -1937,7 +1938,9 @@ functionRegistry.addMultiple({
1937
1938
  return new Anonymous(str instanceof JavaScript ? str.evaluated : str.value);
1938
1939
  },
1939
1940
  escape: function (str) {
1940
- return new Anonymous(encodeURI(str.value).replace(/=/g, "%3D").replace(/:/g, "%3A").replace(/#/g, "%23").replace(/;/g, "%3B").replace(/\(/g, "%28").replace(/\)/g, "%29"));
1941
+ return new Anonymous(
1942
+ encodeURI(str.value).replace(/=/g, "%3D").replace(/:/g, "%3A").replace(/#/g, "%23").replace(/;/g, "%3B")
1943
+ .replace(/\(/g, "%28").replace(/\)/g, "%29"));
1941
1944
  },
1942
1945
  replace: function (string, pattern, replacement, flags) {
1943
1946
  var result = string.value;
@@ -1973,7 +1976,9 @@ module.exports = function(environment) {
1973
1976
  functionRegistry.add("svg-gradient", function(direction) {
1974
1977
 
1975
1978
  function throwArgumentDescriptor() {
1976
- throw { type: "Argument", message: "svg-gradient expects direction, start_color [start_position], [color position,]..., end_color [end_position]" };
1979
+ throw { type: "Argument",
1980
+ message: "svg-gradient expects direction, start_color [start_position], [color position,]...," +
1981
+ " end_color [end_position]" };
1977
1982
  }
1978
1983
 
1979
1984
  if (arguments.length < 3) {
@@ -2008,7 +2013,8 @@ module.exports = function(environment) {
2008
2013
  rectangleDimension = 'x="-50" y="-50" width="101" height="101"';
2009
2014
  break;
2010
2015
  default:
2011
- throw { type: "Argument", message: "svg-gradient direction must be 'to bottom', 'to right', 'to bottom right', 'to top right' or 'ellipse at center'" };
2016
+ throw { type: "Argument", message: "svg-gradient direction must be 'to bottom', 'to right'," +
2017
+ " 'to bottom right', 'to top right' or 'ellipse at center'" };
2012
2018
  }
2013
2019
  returner = '<?xml version="1.0" ?>' +
2014
2020
  '<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="100%" height="100%" viewBox="0 0 1 1" preserveAspectRatio="none">' +
@@ -2023,7 +2029,7 @@ module.exports = function(environment) {
2023
2029
  position = undefined;
2024
2030
  }
2025
2031
 
2026
- if (!(color instanceof Color) || (!((i === 0 || i+1 === stops.length) && position === undefined) && !(position instanceof Dimension))) {
2032
+ if (!(color instanceof Color) || (!((i === 0 || i + 1 === stops.length) && position === undefined) && !(position instanceof Dimension))) {
2027
2033
  throwArgumentDescriptor();
2028
2034
  }
2029
2035
  positionValue = position ? position.toCSS(renderEnv) : i === 0 ? "0%" : "100%";
@@ -2095,7 +2101,9 @@ functionRegistry.addMultiple({
2095
2101
  isunit: isunit,
2096
2102
  unit: function (val, unit) {
2097
2103
  if(!(val instanceof Dimension)) {
2098
- throw { type: "Argument", message: "the first argument to unit must be a number" + (val instanceof Operation ? ". Have you forgotten parenthesis?" : "") };
2104
+ throw { type: "Argument",
2105
+ message: "the first argument to unit must be a number" +
2106
+ (val instanceof Operation ? ". Have you forgotten parenthesis?" : "") };
2099
2107
  }
2100
2108
  if (unit) {
2101
2109
  if (unit instanceof Keyword) {
@@ -2209,7 +2217,10 @@ module.exports = function(environment) {
2209
2217
  // then rootpath should become 'less/../'
2210
2218
  newFileInfo.currentDirectory = fileManager.getPath(resolvedFilename);
2211
2219
  if(newFileInfo.relativeUrls) {
2212
- newFileInfo.rootpath = fileManager.join((importManager.context.rootpath || ""), fileManager.pathDiff(newFileInfo.currentDirectory, newFileInfo.entryPath));
2220
+ newFileInfo.rootpath = fileManager.join(
2221
+ (importManager.context.rootpath || ""),
2222
+ fileManager.pathDiff(newFileInfo.currentDirectory, newFileInfo.entryPath));
2223
+
2213
2224
  if (!fileManager.isPathAbsolute(newFileInfo.rootpath) && fileManager.alwaysMakePathsAbsolute()) {
2214
2225
  newFileInfo.rootpath = fileManager.join(newFileInfo.entryPath, newFileInfo.rootpath);
2215
2226
  }
@@ -2254,7 +2265,7 @@ module.exports = function(environment, fileManagers) {
2254
2265
  var SourceMapOutput, SourceMapBuilder, ParseTree, ImportManager, Environment;
2255
2266
 
2256
2267
  var less = {
2257
- version: [2, 3, 0],
2268
+ version: [2, 3, 1],
2258
2269
  data: require('./data'),
2259
2270
  tree: require('./tree'),
2260
2271
  Environment: (Environment = require("./environment/environment")),
@@ -3070,7 +3081,7 @@ var Parser = function Parser(context, imports, fileInfo) {
3070
3081
  // Ruleset (Selector '.class', [
3071
3082
  // Rule ("color", Value ([Expression [Color #fff]]))
3072
3083
  // Rule ("border", Value ([Expression [Dimension 1px][Keyword "solid"][Color #000]]))
3073
- // Rule ("width", Value ([Expression [Operation "+" [Variable "@w"][Dimension 4px]]]))
3084
+ // Rule ("width", Value ([Expression [Operation " + " [Variable "@w"][Dimension 4px]]]))
3074
3085
  // Ruleset (Selector [Element '>', '.child'], [...])
3075
3086
  // ])
3076
3087
  //
@@ -3320,7 +3331,9 @@ var Parser = function Parser(context, imports, fileInfo) {
3320
3331
  var rgb;
3321
3332
 
3322
3333
  if (parserInput.currentChar() === '#' && (rgb = parserInput.$re(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})/))) {
3323
- var colorCandidateString = rgb.input.match(/^#([\w]+).*/); // strip colons, brackets, whitespaces and other characters that should not definitely be part of color string
3334
+ // strip colons, brackets, whitespaces and other characters that should not
3335
+ // definitely be part of color string
3336
+ var colorCandidateString = rgb.input.match(/^#([\w]+).*/);
3324
3337
  colorCandidateString = colorCandidateString[1];
3325
3338
  if (!colorCandidateString.match(/^[A-Fa-f0-9]+$/)) { // verify if candidate consists only of allowed HEX characters
3326
3339
  error("Invalid HEX color code");
@@ -3416,8 +3429,9 @@ var Parser = function Parser(context, imports, fileInfo) {
3416
3429
  }
3417
3430
 
3418
3431
  option = option && option[1];
3419
- if (!elements)
3432
+ if (!elements) {
3420
3433
  error("Missing target selector for :extend().");
3434
+ }
3421
3435
  extend = new(tree.Extend)(new(tree.Selector)(elements), option, index);
3422
3436
  if (extendList) { extendList.push(extend); } else { extendList = [ extend ]; }
3423
3437
 
@@ -3727,8 +3741,10 @@ var Parser = function Parser(context, imports, fileInfo) {
3727
3741
 
3728
3742
  c = this.combinator();
3729
3743
 
3730
- e = parserInput.$re(/^(?:\d+\.\d+|\d+)%/) || parserInput.$re(/^(?:[.#]?|:*)(?:[\w-]|[^\x00-\x9f]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/) ||
3731
- parserInput.$char('*') || parserInput.$char('&') || this.attribute() || parserInput.$re(/^\([^()@]+\)/) || parserInput.$re(/^[\.#:](?=@)/) ||
3744
+ e = parserInput.$re(/^(?:\d+\.\d+|\d+)%/) ||
3745
+ parserInput.$re(/^(?:[.#]?|:*)(?:[\w-]|[^\x00-\x9f]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/) ||
3746
+ parserInput.$char('*') || parserInput.$char('&') || this.attribute() ||
3747
+ parserInput.$re(/^\([^&()@]+\)/) || parserInput.$re(/^[\.#:](?=@)/) ||
3732
3748
  this.entities.variableCurly();
3733
3749
 
3734
3750
  if (! e) {
@@ -4472,8 +4488,8 @@ Parser.serializeVars = function(vars) {
4472
4488
  for (var name in vars) {
4473
4489
  if (Object.hasOwnProperty.call(vars, name)) {
4474
4490
  var value = vars[name];
4475
- s += ((name[0] === '@') ? '' : '@') + name +': '+ value +
4476
- ((('' + value).slice(-1) === ';') ? '' : ';');
4491
+ s += ((name[0] === '@') ? '' : '@') + name + ': ' + value +
4492
+ ((String(value).slice(-1) === ';') ? '' : ';');
4477
4493
  }
4478
4494
  }
4479
4495
 
@@ -4696,7 +4712,7 @@ module.exports = function (environment) {
4696
4712
  }
4697
4713
  if (options.sourceMapRootpath) {
4698
4714
  this._sourceMapRootpath = options.sourceMapRootpath.replace(/\\/g, '/');
4699
- if (this._sourceMapRootpath.charAt(this._sourceMapRootpath.length-1) !== '/') {
4715
+ if (this._sourceMapRootpath.charAt(this._sourceMapRootpath.length - 1) !== '/') {
4700
4716
  this._sourceMapRootpath += '/';
4701
4717
  }
4702
4718
  } else {
@@ -4747,11 +4763,11 @@ module.exports = function (environment) {
4747
4763
  }
4748
4764
  inputSource = inputSource.substring(0, index);
4749
4765
  sourceLines = inputSource.split("\n");
4750
- sourceColumns = sourceLines[sourceLines.length-1];
4766
+ sourceColumns = sourceLines[sourceLines.length - 1];
4751
4767
  }
4752
4768
 
4753
4769
  lines = chunk.split("\n");
4754
- columns = lines[lines.length-1];
4770
+ columns = lines[lines.length - 1];
4755
4771
 
4756
4772
  if (fileInfo) {
4757
4773
  if (!mapLines) {
@@ -4867,7 +4883,7 @@ module.exports = function(root, options) {
4867
4883
 
4868
4884
  if (options.pluginManager) {
4869
4885
  var pluginVisitors = options.pluginManager.getVisitors();
4870
- for(i =0; i < pluginVisitors.length; i++) {
4886
+ for(i = 0; i < pluginVisitors.length; i++) {
4871
4887
  var pluginVisitor = pluginVisitors[i];
4872
4888
  if (pluginVisitor.isPreEvalVisitor) {
4873
4889
  preEvalVisitors.push(pluginVisitor);
@@ -5344,7 +5360,7 @@ Condition.prototype.eval = function (context) {
5344
5360
  default: return false;
5345
5361
  }
5346
5362
  }
5347
- }) (this.op, this.lvalue.eval(context), this.rvalue.eval(context));
5363
+ })(this.op, this.lvalue.eval(context), this.rvalue.eval(context));
5348
5364
 
5349
5365
  return this.negate ? !result : result;
5350
5366
  };
@@ -5352,7 +5368,7 @@ module.exports = Condition;
5352
5368
 
5353
5369
  },{"./node":67}],51:[function(require,module,exports){
5354
5370
  var debugInfo = function(context, ctx, lineSeparator) {
5355
- var result="";
5371
+ var result = "";
5356
5372
  if (context.dumpLineNumbers && !context.compress) {
5357
5373
  switch(context.dumpLineNumbers) {
5358
5374
  case 'comments':
@@ -5374,8 +5390,12 @@ debugInfo.asComment = function(ctx) {
5374
5390
  };
5375
5391
 
5376
5392
  debugInfo.asMediaQuery = function(ctx) {
5393
+ var filenameWithProtocol = ctx.debugInfo.fileName;
5394
+ if (!/^[a-z]+:\/\//i.test(filenameWithProtocol)) {
5395
+ filenameWithProtocol = 'file://' + filenameWithProtocol;
5396
+ }
5377
5397
  return '@media -sass-debug-info{filename{font-family:' +
5378
- ('file://' + ctx.debugInfo.fileName).replace(/([.:\/\\])/g, function (a) {
5398
+ filenameWithProtocol.replace(/([.:\/\\])/g, function (a) {
5379
5399
  if (a == '\\') {
5380
5400
  a = '\/';
5381
5401
  }
@@ -5437,7 +5457,7 @@ Dimension.prototype.toColor = function () {
5437
5457
  };
5438
5458
  Dimension.prototype.genCSS = function (context, output) {
5439
5459
  if ((context && context.strictUnits) && !this.unit.isSingular()) {
5440
- throw new Error("Multiple units in dimension. Correct the units or use the unit function. Bad unit: "+this.unit.toString());
5460
+ throw new Error("Multiple units in dimension. Correct the units or use the unit function. Bad unit: " + this.unit.toString());
5441
5461
  }
5442
5462
 
5443
5463
  var value = this.fround(context, this.value),
@@ -5628,9 +5648,21 @@ Directive.prototype.eval = function (context) {
5628
5648
  return new Directive(this.name, value, rules,
5629
5649
  this.index, this.currentFileInfo, this.debugInfo, this.isReferenced);
5630
5650
  };
5631
- Directive.prototype.variable = function (name) { if (this.rules) return Ruleset.prototype.variable.call(this.rules, name); };
5632
- Directive.prototype.find = function () { if (this.rules) return Ruleset.prototype.find.apply(this.rules, arguments); };
5633
- Directive.prototype.rulesets = function () { if (this.rules) return Ruleset.prototype.rulesets.apply(this.rules); };
5651
+ Directive.prototype.variable = function (name) {
5652
+ if (this.rules) {
5653
+ return Ruleset.prototype.variable.call(this.rules, name);
5654
+ }
5655
+ };
5656
+ Directive.prototype.find = function () {
5657
+ if (this.rules) {
5658
+ return Ruleset.prototype.find.apply(this.rules, arguments);
5659
+ }
5660
+ };
5661
+ Directive.prototype.rulesets = function () {
5662
+ if (this.rules) {
5663
+ return Ruleset.prototype.rulesets.apply(this.rules);
5664
+ }
5665
+ };
5634
5666
  Directive.prototype.markReferenced = function () {
5635
5667
  var i, rules;
5636
5668
  this.isReferenced = true;
@@ -5948,7 +5980,7 @@ Import.prototype.evalPath = function (context) {
5948
5980
  var pathValue = path.value;
5949
5981
  // Add the base path if the import is relative
5950
5982
  if (pathValue && context.isPathRelative(pathValue)) {
5951
- path.value = rootpath +pathValue;
5983
+ path.value = rootpath + pathValue;
5952
5984
  }
5953
5985
  }
5954
5986
  path.value = context.normalizePath(path.value);
@@ -6296,8 +6328,9 @@ Media.prototype.permute = function (arr) {
6296
6328
  }
6297
6329
  };
6298
6330
  Media.prototype.bubbleSelectors = function (selectors) {
6299
- if (!selectors)
6300
- return;
6331
+ if (!selectors) {
6332
+ return;
6333
+ }
6301
6334
  this.rules = [new Ruleset(selectors.slice(0), [this.rules[0]])];
6302
6335
  };
6303
6336
  module.exports = Media;
@@ -6327,7 +6360,7 @@ MixinCall.prototype.accept = function (visitor) {
6327
6360
  };
6328
6361
  MixinCall.prototype.eval = function (context) {
6329
6362
  var mixins, mixin, mixinPath, args, rules = [], match = false, i, m, f, isRecursive, isOneFound, rule,
6330
- candidates = [], candidate, conditionResult = [], defaultResult, defFalseEitherCase=-1,
6363
+ candidates = [], candidate, conditionResult = [], defaultResult, defFalseEitherCase = -1,
6331
6364
  defNone = 0, defTrue = 1, defFalse = 2, count, originalRuleset, noArgumentsFilter;
6332
6365
 
6333
6366
  function calcDefGroup(mixin, mixinPath) {
@@ -6389,7 +6422,7 @@ MixinCall.prototype.eval = function (context) {
6389
6422
  if (mixin.matchArgs(args, context)) {
6390
6423
  candidate = {mixin: mixin, group: calcDefGroup(mixin, mixinPath)};
6391
6424
 
6392
- if (candidate.group!==defFalseEitherCase) {
6425
+ if (candidate.group !== defFalseEitherCase) {
6393
6426
  candidates.push(candidate);
6394
6427
  }
6395
6428
 
@@ -6410,8 +6443,7 @@ MixinCall.prototype.eval = function (context) {
6410
6443
  defaultResult = defTrue;
6411
6444
  if ((count[defTrue] + count[defFalse]) > 1) {
6412
6445
  throw { type: 'Runtime',
6413
- message: 'Ambiguous use of `default()` found when matching for `'
6414
- + this.format(args) + '`',
6446
+ message: 'Ambiguous use of `default()` found when matching for `' + this.format(args) + '`',
6415
6447
  index: this.index, filename: this.currentFileInfo.filename };
6416
6448
  }
6417
6449
  }
@@ -6609,9 +6641,10 @@ Definition.prototype.evalCall = function (context, args, important) {
6609
6641
  Definition.prototype.matchCondition = function (args, context) {
6610
6642
  if (this.condition && !this.condition.eval(
6611
6643
  new contexts.Eval(context,
6612
- [this.evalParams(context, new contexts.Eval(context, this.frames ? this.frames.concat(context.frames) : context.frames), args, [])] // the parameter variables
6613
- .concat(this.frames) // the parent namespace/mixin frames
6614
- .concat(context.frames)))) { // the current environment frames
6644
+ [this.evalParams(context, /* the parameter variables*/
6645
+ new contexts.Eval(context, this.frames ? this.frames.concat(context.frames) : context.frames), args, [])]
6646
+ .concat(this.frames) // the parent namespace/mixin frames
6647
+ .concat(context.frames)))) { // the current environment frames
6615
6648
  return false;
6616
6649
  }
6617
6650
  return true;
@@ -6845,7 +6878,7 @@ Quoted.prototype.eval = function (context) {
6845
6878
  do {
6846
6879
  value = evaluatedValue;
6847
6880
  evaluatedValue = value.replace(regexp, replacementFnc);
6848
- } while (value!==evaluatedValue);
6881
+ } while (value !== evaluatedValue);
6849
6882
  return evaluatedValue;
6850
6883
  }
6851
6884
  value = iterativeReplace(value, /`([^`]+)`/g, javascriptReplacement);
@@ -6907,9 +6940,8 @@ Rule.prototype.eval = function (context) {
6907
6940
  if (typeof name !== "string") {
6908
6941
  // expand 'primitive' name directly to get
6909
6942
  // things faster (~10% for benchmark.less):
6910
- name = (name.length === 1)
6911
- && (name[0] instanceof Keyword)
6912
- ? name[0].value : evalName(context, name);
6943
+ name = (name.length === 1) && (name[0] instanceof Keyword) ?
6944
+ name[0].value : evalName(context, name);
6913
6945
  variable = false; // never treat expanded interpolation as new variable name
6914
6946
  }
6915
6947
  if (name === "font" && !context.strictMath) {
@@ -6980,6 +7012,7 @@ var Node = require("./node"),
6980
7012
  Rule = require("./rule"),
6981
7013
  Selector = require("./selector"),
6982
7014
  Element = require("./element"),
7015
+ Paren = require("./paren"),
6983
7016
  contexts = require("../contexts"),
6984
7017
  defaultFunc = require("../functions/default"),
6985
7018
  getDebugInfo = require("./debug-info");
@@ -7085,7 +7118,7 @@ Ruleset.prototype.eval = function (context) {
7085
7118
  });
7086
7119
  rsRules.splice.apply(rsRules, [i, 1].concat(rules));
7087
7120
  rsRuleCnt += rules.length - 1;
7088
- i += rules.length-1;
7121
+ i += rules.length - 1;
7089
7122
  ruleset.resetCache();
7090
7123
  } else if (rsRules[i].type === "RulesetCall") {
7091
7124
  /*jshint loopfunc:true */
@@ -7098,7 +7131,7 @@ Ruleset.prototype.eval = function (context) {
7098
7131
  });
7099
7132
  rsRules.splice.apply(rsRules, [i, 1].concat(rules));
7100
7133
  rsRuleCnt += rules.length - 1;
7101
- i += rules.length-1;
7134
+ i += rules.length - 1;
7102
7135
  ruleset.resetCache();
7103
7136
  }
7104
7137
  }
@@ -7151,7 +7184,7 @@ Ruleset.prototype.evalImports = function(context) {
7151
7184
  importRules = rules[i].eval(context);
7152
7185
  if (importRules && importRules.length) {
7153
7186
  rules.splice.apply(rules, [i, 1].concat(importRules));
7154
- i+= importRules.length-1;
7187
+ i+= importRules.length - 1;
7155
7188
  } else {
7156
7189
  rules.splice(i, 1, importRules);
7157
7190
  }
@@ -7173,7 +7206,7 @@ Ruleset.prototype.makeImportant = function() {
7173
7206
  };
7174
7207
  // lets you call a css selector with a guard
7175
7208
  Ruleset.prototype.matchCondition = function (args, context) {
7176
- var lastSelector = this.selectors[this.selectors.length-1];
7209
+ var lastSelector = this.selectors[this.selectors.length - 1];
7177
7210
  if (!lastSelector.evaldCondition) {
7178
7211
  return false;
7179
7212
  }
@@ -7401,8 +7434,9 @@ Ruleset.prototype.markReferenced = function () {
7401
7434
 
7402
7435
  if (this.rules) {
7403
7436
  for (s = 0; s < this.rules.length; s++) {
7404
- if (this.rules[s].markReferenced)
7437
+ if (this.rules[s].markReferenced) {
7405
7438
  this.rules[s].markReferenced();
7439
+ }
7406
7440
  }
7407
7441
  }
7408
7442
  };
@@ -7410,20 +7444,22 @@ Ruleset.prototype.getIsReferenced = function() {
7410
7444
  var i, j, path, selector;
7411
7445
 
7412
7446
  if (this.paths) {
7413
- for (i=0; i<this.paths.length; i++) {
7447
+ for (i = 0; i < this.paths.length; i++) {
7414
7448
  path = this.paths[i];
7415
- for (j=0; j<path.length; j++) {
7416
- if (path[j].getIsReferenced && path[j].getIsReferenced())
7449
+ for (j = 0; j < path.length; j++) {
7450
+ if (path[j].getIsReferenced && path[j].getIsReferenced()) {
7417
7451
  return true;
7452
+ }
7418
7453
  }
7419
7454
  }
7420
7455
  }
7421
7456
 
7422
7457
  if (this.selectors) {
7423
- for (i=0;i<this.selectors.length;i++) {
7458
+ for (i = 0; i < this.selectors.length; i++) {
7424
7459
  selector = this.selectors[i];
7425
- if (selector.getIsReferenced && selector.getIsReferenced())
7460
+ if (selector.getIsReferenced && selector.getIsReferenced()) {
7426
7461
  return true;
7462
+ }
7427
7463
  }
7428
7464
  }
7429
7465
  return false;
@@ -7437,180 +7473,250 @@ Ruleset.prototype.joinSelectors = function (paths, context, selectors) {
7437
7473
 
7438
7474
  Ruleset.prototype.joinSelector = function (paths, context, selector) {
7439
7475
 
7440
- var i, j, k,
7441
- hasParentSelector, newSelectors, el, sel, parentSel,
7442
- newSelectorPath, afterParentJoin, newJoinedSelector,
7443
- newJoinedSelectorEmpty, lastSelector, currentElements,
7444
- selectorsMultiplied;
7445
-
7446
- for (i = 0; i < selector.elements.length; i++) {
7447
- el = selector.elements[i];
7448
- if (el.value === '&') {
7449
- hasParentSelector = true;
7450
- }
7451
- }
7476
+ function createParenthesis(elementsToPak, originalElement) {
7477
+ var replacementParen, j;
7478
+ if (elementsToPak.length === 0) {
7479
+ replacementParen = new Paren(elementsToPak[0]);
7480
+ } else {
7481
+ var insideParent = [];
7482
+ for (j = 0; j < elementsToPak.length; j++) {
7483
+ insideParent.push(new Element(null, elementsToPak[j], originalElement.index, originalElement.currentFileInfo));
7484
+ }
7485
+ replacementParen = new Paren(new Selector(insideParent));
7486
+ }
7487
+ return replacementParen;
7488
+ }
7489
+
7490
+ function createSelector(containedElement, originalElement) {
7491
+ var element, selector;
7492
+ element = new Element(null, containedElement, originalElement.index, originalElement.currentFileInfo);
7493
+ selector = new Selector([element]);
7494
+ return selector;
7495
+ }
7496
+
7497
+ // replace all parent selectors inside `inSelector` by content of `context` array
7498
+ // resulting selectors are returned inside `paths` array
7499
+ // returns true if `inSelector` contained at least one parent selector
7500
+ function replaceParentSelector(paths, context, inSelector) {
7501
+ // The paths are [[Selector]]
7502
+ // The first list is a list of comma separated selectors
7503
+ // The inner list is a list of inheritance separated selectors
7504
+ // e.g.
7505
+ // .a, .b {
7506
+ // .c {
7507
+ // }
7508
+ // }
7509
+ // == [[.a] [.c]] [[.b] [.c]]
7510
+ //
7511
+ var i, j, k, currentElements, newSelectors, selectorsMultiplied, sel, el, hadParentSelector = false;
7512
+ function findNestedSelector(element) {
7513
+ var maybeSelector;
7514
+ if (element.value.type !== 'Paren') {
7515
+ return null;
7516
+ }
7452
7517
 
7453
- if (!hasParentSelector) {
7454
- if (context.length > 0) {
7455
- for (i = 0; i < context.length; i++) {
7456
- paths.push(context[i].concat(selector));
7518
+ maybeSelector = element.value.value;
7519
+ if (maybeSelector.type !== 'Selector') {
7520
+ return null;
7457
7521
  }
7522
+
7523
+ return maybeSelector;
7458
7524
  }
7459
- else {
7460
- paths.push([selector]);
7461
- }
7462
- return;
7463
- }
7464
7525
 
7465
- // The paths are [[Selector]]
7466
- // The first list is a list of comma separated selectors
7467
- // The inner list is a list of inheritance separated selectors
7468
- // e.g.
7469
- // .a, .b {
7470
- // .c {
7471
- // }
7472
- // }
7473
- // == [[.a] [.c]] [[.b] [.c]]
7474
- //
7526
+ // the elements from the current selector so far
7527
+ currentElements = [];
7528
+ // the current list of new selectors to add to the path.
7529
+ // We will build it up. We initiate it with one empty selector as we "multiply" the new selectors
7530
+ // by the parents
7531
+ newSelectors = [
7532
+ []
7533
+ ];
7475
7534
 
7476
- // the elements from the current selector so far
7477
- currentElements = [];
7478
- // the current list of new selectors to add to the path.
7479
- // We will build it up. We initiate it with one empty selector as we "multiply" the new selectors
7480
- // by the parents
7481
- newSelectors = [[]];
7482
-
7483
- for (i = 0; i < selector.elements.length; i++) {
7484
- el = selector.elements[i];
7485
- // non parent reference elements just get added
7486
- if (el.value !== "&") {
7487
- currentElements.push(el);
7488
- } else {
7489
- // the new list of selectors to add
7490
- selectorsMultiplied = [];
7491
-
7492
- // merge the current list of non parent selector elements
7493
- // on to the current list of selectors to add
7494
- if (currentElements.length > 0) {
7495
- this.mergeElementsOnToSelectors(currentElements, newSelectors);
7496
- }
7497
-
7498
- // loop through our current selectors
7499
- for (j = 0; j < newSelectors.length; j++) {
7500
- sel = newSelectors[j];
7501
- // if we don't have any parent paths, the & might be in a mixin so that it can be used
7502
- // whether there are parents or not
7503
- if (context.length === 0) {
7504
- // the combinator used on el should now be applied to the next element instead so that
7505
- // it is not lost
7506
- if (sel.length > 0) {
7507
- sel[0].elements = sel[0].elements.slice(0);
7508
- sel[0].elements.push(new Element(el.combinator, '', el.index, el.currentFileInfo));
7535
+ for (i = 0; i < inSelector.elements.length; i++) {
7536
+ el = inSelector.elements[i];
7537
+ // non parent reference elements just get added
7538
+ if (el.value !== "&") {
7539
+ var nestedSelector = findNestedSelector(el);
7540
+ if (nestedSelector != null) {
7541
+ // merge the current list of non parent selector elements
7542
+ // on to the current list of selectors to add
7543
+ mergeElementsOnToSelectors(currentElements, newSelectors);
7544
+
7545
+ var nestedPaths = [], replaced, replacedNewSelectors = [];
7546
+ replaced = replaceParentSelector(nestedPaths, context, nestedSelector);
7547
+ hadParentSelector = hadParentSelector || replaced;
7548
+ //the nestedPaths array should have only one member - replaceParentSelector does not multiply selectors
7549
+ for (k = 0; k < nestedPaths.length; k++) {
7550
+ var replacementSelector = createSelector(createParenthesis(nestedPaths[k], el), el);
7551
+ addAllReplacementsIntoPath(newSelectors, [replacementSelector], el, inSelector, replacedNewSelectors);
7509
7552
  }
7510
- selectorsMultiplied.push(sel);
7553
+ newSelectors = replacedNewSelectors;
7554
+ currentElements = [];
7555
+
7556
+ } else {
7557
+ currentElements.push(el);
7511
7558
  }
7512
- else {
7513
- // and the parent selectors
7514
- for (k = 0; k < context.length; k++) {
7515
- parentSel = context[k];
7516
- // We need to put the current selectors
7517
- // then join the last selector's elements on to the parents selectors
7518
-
7519
- // our new selector path
7520
- newSelectorPath = [];
7521
- // selectors from the parent after the join
7522
- afterParentJoin = [];
7523
- newJoinedSelectorEmpty = true;
7524
-
7525
- //construct the joined selector - if & is the first thing this will be empty,
7526
- // if not newJoinedSelector will be the last set of elements in the selector
7559
+
7560
+ } else {
7561
+ hadParentSelector = true;
7562
+ // the new list of selectors to add
7563
+ selectorsMultiplied = [];
7564
+
7565
+ // merge the current list of non parent selector elements
7566
+ // on to the current list of selectors to add
7567
+ mergeElementsOnToSelectors(currentElements, newSelectors);
7568
+
7569
+ // loop through our current selectors
7570
+ for (j = 0; j < newSelectors.length; j++) {
7571
+ sel = newSelectors[j];
7572
+ // if we don't have any parent paths, the & might be in a mixin so that it can be used
7573
+ // whether there are parents or not
7574
+ if (context.length === 0) {
7575
+ // the combinator used on el should now be applied to the next element instead so that
7576
+ // it is not lost
7527
7577
  if (sel.length > 0) {
7528
- newSelectorPath = sel.slice(0);
7529
- lastSelector = newSelectorPath.pop();
7530
- newJoinedSelector = selector.createDerived(lastSelector.elements.slice(0));
7531
- newJoinedSelectorEmpty = false;
7578
+ sel[0].elements.push(new Element(el.combinator, '', el.index, el.currentFileInfo));
7532
7579
  }
7533
- else {
7534
- newJoinedSelector = selector.createDerived([]);
7580
+ selectorsMultiplied.push(sel);
7581
+ }
7582
+ else {
7583
+ // and the parent selectors
7584
+ for (k = 0; k < context.length; k++) {
7585
+ // We need to put the current selectors
7586
+ // then join the last selector's elements on to the parents selectors
7587
+ var newSelectorPath = addReplacementIntoPath(sel, context[k], el, inSelector);
7588
+ // add that to our new set of selectors
7589
+ selectorsMultiplied.push(newSelectorPath);
7535
7590
  }
7591
+ }
7592
+ }
7536
7593
 
7537
- //put together the parent selectors after the join
7538
- if (parentSel.length > 1) {
7539
- afterParentJoin = afterParentJoin.concat(parentSel.slice(1));
7540
- }
7594
+ // our new selectors has been multiplied, so reset the state
7595
+ newSelectors = selectorsMultiplied;
7596
+ currentElements = [];
7597
+ }
7598
+ }
7541
7599
 
7542
- if (parentSel.length > 0) {
7543
- newJoinedSelectorEmpty = false;
7544
-
7545
- // /deep/ is a combinator that is valid without anything in front of it
7546
- // so if the & does not have a combinator that is "" or " " then
7547
- // and there is a combinator on the parent, then grab that.
7548
- // this also allows + a { & .b { .a & { ... though not sure why you would want to do that
7549
- var combinator = el.combinator,
7550
- parentEl = parentSel[0].elements[0];
7551
- if (combinator.emptyOrWhitespace && !parentEl.combinator.emptyOrWhitespace) {
7552
- combinator = parentEl.combinator;
7553
- }
7554
- // join the elements so far with the first part of the parent
7555
- newJoinedSelector.elements.push(new Element(combinator, parentEl.value, el.index, el.currentFileInfo));
7556
- newJoinedSelector.elements = newJoinedSelector.elements.concat(parentSel[0].elements.slice(1));
7557
- }
7600
+ // if we have any elements left over (e.g. .a& .b == .b)
7601
+ // add them on to all the current selectors
7602
+ mergeElementsOnToSelectors(currentElements, newSelectors);
7558
7603
 
7559
- if (!newJoinedSelectorEmpty) {
7560
- // now add the joined selector
7561
- newSelectorPath.push(newJoinedSelector);
7562
- }
7604
+ for (i = 0; i < newSelectors.length; i++) {
7605
+ if (newSelectors[i].length > 0) {
7606
+ paths.push(newSelectors[i]);
7607
+ }
7608
+ }
7563
7609
 
7564
- // and the rest of the parent
7565
- newSelectorPath = newSelectorPath.concat(afterParentJoin);
7610
+ return hadParentSelector;
7611
+ }
7566
7612
 
7567
- // add that to our new set of selectors
7568
- selectorsMultiplied.push(newSelectorPath);
7569
- }
7570
- }
7613
+ // joins selector path from `beginningPath` with selector path in `addPath`
7614
+ // `replacedElement` contains element that is being replaced by `addPath`
7615
+ // returns concatenated path
7616
+ function addReplacementIntoPath(beginningPath, addPath, replacedElement, originalSelector) {
7617
+ var newSelectorPath, lastSelector, newJoinedSelector;
7618
+ // our new selector path
7619
+ newSelectorPath = [];
7620
+
7621
+ //construct the joined selector - if & is the first thing this will be empty,
7622
+ // if not newJoinedSelector will be the last set of elements in the selector
7623
+ if (beginningPath.length > 0) {
7624
+ newSelectorPath = beginningPath.slice(0);
7625
+ lastSelector = newSelectorPath.pop();
7626
+ newJoinedSelector = originalSelector.createDerived(lastSelector.elements.slice(0));
7627
+ }
7628
+ else {
7629
+ newJoinedSelector = originalSelector.createDerived([]);
7630
+ }
7631
+
7632
+ if (addPath.length > 0) {
7633
+ // /deep/ is a combinator that is valid without anything in front of it
7634
+ // so if the & does not have a combinator that is "" or " " then
7635
+ // and there is a combinator on the parent, then grab that.
7636
+ // this also allows + a { & .b { .a & { ... though not sure why you would want to do that
7637
+ var combinator = replacedElement.combinator, parentEl = addPath[0].elements[0];
7638
+ if (combinator.emptyOrWhitespace && !parentEl.combinator.emptyOrWhitespace) {
7639
+ combinator = parentEl.combinator;
7571
7640
  }
7641
+ // join the elements so far with the first part of the parent
7642
+ newJoinedSelector.elements.push(new Element(combinator, parentEl.value, replacedElement.index, replacedElement.currentFileInfo));
7643
+ newJoinedSelector.elements = newJoinedSelector.elements.concat(addPath[0].elements.slice(1));
7644
+ }
7572
7645
 
7573
- // our new selectors has been multiplied, so reset the state
7574
- newSelectors = selectorsMultiplied;
7575
- currentElements = [];
7646
+ // now add the joined selector - but only if it is not empty
7647
+ if (newJoinedSelector.elements.length !== 0) {
7648
+ newSelectorPath.push(newJoinedSelector);
7576
7649
  }
7577
- }
7578
7650
 
7579
- // if we have any elements left over (e.g. .a& .b == .b)
7580
- // add them on to all the current selectors
7581
- if (currentElements.length > 0) {
7582
- this.mergeElementsOnToSelectors(currentElements, newSelectors);
7651
+ //put together the parent selectors after the join (e.g. the rest of the parent)
7652
+ if (addPath.length > 1) {
7653
+ newSelectorPath = newSelectorPath.concat(addPath.slice(1));
7654
+ }
7655
+ return newSelectorPath;
7583
7656
  }
7584
7657
 
7585
- for (i = 0; i < newSelectors.length; i++) {
7586
- if (newSelectors[i].length > 0) {
7587
- paths.push(newSelectors[i]);
7658
+ // joins selector path from `beginningPath` with every selector path in `addPaths` array
7659
+ // `replacedElement` contains element that is being replaced by `addPath`
7660
+ // returns array with all concatenated paths
7661
+ function addAllReplacementsIntoPath( beginningPath, addPaths, replacedElement, originalSelector, result) {
7662
+ var j;
7663
+ for (j = 0; j < beginningPath.length; j++) {
7664
+ var newSelectorPath = addReplacementIntoPath(beginningPath[j], addPaths, replacedElement, originalSelector);
7665
+ result.push(newSelectorPath);
7588
7666
  }
7667
+ return result;
7589
7668
  }
7590
- };
7591
- Ruleset.prototype.mergeElementsOnToSelectors = function(elements, selectors) {
7592
- var i, sel;
7593
7669
 
7594
- if (selectors.length === 0) {
7595
- selectors.push([ new Selector(elements) ]);
7596
- return;
7670
+ function mergeElementsOnToSelectors(elements, selectors) {
7671
+ var i, sel;
7672
+
7673
+ if (elements.length === 0) {
7674
+ return ;
7675
+ }
7676
+ if (selectors.length === 0) {
7677
+ selectors.push([ new Selector(elements) ]);
7678
+ return;
7679
+ }
7680
+
7681
+ for (i = 0; i < selectors.length; i++) {
7682
+ sel = selectors[i];
7683
+
7684
+ // if the previous thing in sel is a parent this needs to join on to it
7685
+ if (sel.length > 0) {
7686
+ sel[sel.length - 1] = sel[sel.length - 1].createDerived(sel[sel.length - 1].elements.concat(elements));
7687
+ }
7688
+ else {
7689
+ sel.push(new Selector(elements));
7690
+ }
7691
+ }
7597
7692
  }
7598
7693
 
7599
- for (i = 0; i < selectors.length; i++) {
7600
- sel = selectors[i];
7694
+ // joinSelector code follows
7695
+ var i, newPaths, hadParentSelector;
7696
+
7697
+ newPaths = [];
7698
+ hadParentSelector = replaceParentSelector(newPaths, context, selector);
7601
7699
 
7602
- // if the previous thing in sel is a parent this needs to join on to it
7603
- if (sel.length > 0) {
7604
- sel[sel.length - 1] = sel[sel.length - 1].createDerived(sel[sel.length - 1].elements.concat(elements));
7700
+ if (!hadParentSelector) {
7701
+ if (context.length > 0) {
7702
+ newPaths = [];
7703
+ for (i = 0; i < context.length; i++) {
7704
+ newPaths.push(context[i].concat(selector));
7705
+ }
7605
7706
  }
7606
7707
  else {
7607
- sel.push(new Selector(elements));
7708
+ newPaths = [[selector]];
7608
7709
  }
7609
7710
  }
7711
+
7712
+ for (i = 0; i < newPaths.length; i++) {
7713
+ paths.push(newPaths[i]);
7714
+ }
7715
+
7610
7716
  };
7611
7717
  module.exports = Ruleset;
7612
7718
 
7613
- },{"../contexts":10,"../functions/default":19,"./debug-info":51,"./element":55,"./node":67,"./rule":71,"./selector":74}],74:[function(require,module,exports){
7719
+ },{"../contexts":10,"../functions/default":19,"./debug-info":51,"./element":55,"./node":67,"./paren":69,"./rule":71,"./selector":74}],74:[function(require,module,exports){
7614
7720
  var Node = require("./node");
7615
7721
 
7616
7722
  var Selector = function (elements, extendList, condition, index, currentFileInfo, isReferenced) {
@@ -7664,8 +7770,9 @@ Selector.prototype.match = function (other) {
7664
7770
  return olen; // return number of matched elements
7665
7771
  };
7666
7772
  Selector.prototype.CacheElements = function() {
7667
- if (this._elements)
7773
+ if (this._elements) {
7668
7774
  return;
7775
+ }
7669
7776
 
7670
7777
  var elements = this.elements.map( function(v) {
7671
7778
  return v.combinator.value + (v.value.value || v.value);
@@ -7882,7 +7989,7 @@ URL.prototype.eval = function (context) {
7882
7989
  context.isPathRelative(val.value)) {
7883
7990
 
7884
7991
  if (!val.quote) {
7885
- rootpath = rootpath.replace(/[\(\)'"\s]/g, function(match) { return "\\"+match; });
7992
+ rootpath = rootpath.replace(/[\(\)'"\s]/g, function(match) { return "\\" + match; });
7886
7993
  }
7887
7994
  val.value = rootpath + val.value;
7888
7995
  }
@@ -7936,7 +8043,7 @@ Value.prototype.genCSS = function (context, output) {
7936
8043
  var i;
7937
8044
  for(i = 0; i < this.value.length; i++) {
7938
8045
  this.value[i].genCSS(context, output);
7939
- if (i+1 < this.value.length) {
8046
+ if (i + 1 < this.value.length) {
7940
8047
  output.add((context && context.compress) ? ',' : ', ');
7941
8048
  }
7942
8049
  }
@@ -7973,7 +8080,7 @@ Variable.prototype.eval = function (context) {
7973
8080
  var v = frame.variable(name);
7974
8081
  if (v) {
7975
8082
  if (v.important) {
7976
- var importantScope = context.importantScope[context.importantScope.length-1];
8083
+ var importantScope = context.importantScope[context.importantScope.length - 1];
7977
8084
  importantScope.important = v.important;
7978
8085
  }
7979
8086
  return v.value.eval(context);
@@ -8084,7 +8191,7 @@ ExtendFinderVisitor.prototype = {
8084
8191
  extend.findSelfSelectors(selectorPath);
8085
8192
  extend.ruleset = rulesetNode;
8086
8193
  if (j === 0) { extend.firstExtendOnThisSelectorPath = true; }
8087
- this.allExtendsStack[this.allExtendsStack.length-1].push(extend);
8194
+ this.allExtendsStack[this.allExtendsStack.length - 1].push(extend);
8088
8195
  }
8089
8196
  }
8090
8197
 
@@ -8139,21 +8246,22 @@ ProcessExtendsVisitor.prototype = {
8139
8246
 
8140
8247
  if(!indicies[extend.index + ' ' + selector]) {
8141
8248
  indicies[extend.index + ' ' + selector] = true;
8142
- logger.warn("extend '"+selector+"' has no matches");
8249
+ logger.warn("extend '" + selector + "' has no matches");
8143
8250
  }
8144
8251
  });
8145
8252
  },
8146
8253
  doExtendChaining: function (extendsList, extendsListTarget, iterationCount) {
8147
8254
  //
8148
- // chaining is different from normal extension.. if we extend an extend then we are not just copying, altering and pasting
8149
- // the selector we would do normally, but we are also adding an extend with the same target selector
8255
+ // chaining is different from normal extension.. if we extend an extend then we are not just copying, altering
8256
+ // and pasting the selector we would do normally, but we are also adding an extend with the same target selector
8150
8257
  // this means this new extend can then go and alter other extends
8151
8258
  //
8152
8259
  // this method deals with all the chaining work - without it, extend is flat and doesn't work on other extend selectors
8153
- // this is also the most expensive.. and a match on one selector can cause an extension of a selector we had already processed if
8154
- // we look at each selector at a time, as is done in visitRuleset
8260
+ // this is also the most expensive.. and a match on one selector can cause an extension of a selector we had already
8261
+ // processed if we look at each selector at a time, as is done in visitRuleset
8155
8262
 
8156
- var extendIndex, targetExtendIndex, matches, extendsToAdd = [], newSelector, extendVisitor = this, selectorPath, extend, targetExtend, newExtend;
8263
+ var extendIndex, targetExtendIndex, matches, extendsToAdd = [], newSelector, extendVisitor = this, selectorPath,
8264
+ extend, targetExtend, newExtend;
8157
8265
 
8158
8266
  iterationCount = iterationCount || 0;
8159
8267
 
@@ -8191,7 +8299,7 @@ ProcessExtendsVisitor.prototype = {
8191
8299
  newExtend.selfSelectors = newSelector;
8192
8300
 
8193
8301
  // add the extend onto the list of extends for that selector
8194
- newSelector[newSelector.length-1].extendList = [newExtend];
8302
+ newSelector[newSelector.length - 1].extendList = [newExtend];
8195
8303
 
8196
8304
  // record that we need to add it.
8197
8305
  extendsToAdd.push(newExtend);
@@ -8225,11 +8333,13 @@ ProcessExtendsVisitor.prototype = {
8225
8333
  selectorTwo = extendsToAdd[0].selector.toCSS();
8226
8334
  }
8227
8335
  catch(e) {}
8228
- throw {message: "extend circular reference detected. One of the circular extends is currently:"+selectorOne+":extend(" + selectorTwo+")"};
8336
+ throw { message: "extend circular reference detected. One of the circular extends is currently:" +
8337
+ selectorOne + ":extend(" + selectorTwo + ")"};
8229
8338
  }
8230
8339
 
8231
- // now process the new extends on the existing rules so that we can handle a extending b extending c ectending d extending e...
8232
- return extendsToAdd.concat(extendVisitor.doExtendChaining(extendsToAdd, extendsListTarget, iterationCount+1));
8340
+ // now process the new extends on the existing rules so that we can handle a extending b extending c extending
8341
+ // d extending e...
8342
+ return extendsToAdd.concat(extendVisitor.doExtendChaining(extendsToAdd, extendsListTarget, iterationCount + 1));
8233
8343
  } else {
8234
8344
  return extendsToAdd;
8235
8345
  }
@@ -8247,7 +8357,8 @@ ProcessExtendsVisitor.prototype = {
8247
8357
  if (rulesetNode.root) {
8248
8358
  return;
8249
8359
  }
8250
- var matches, pathIndex, extendIndex, allExtends = this.allExtendsStack[this.allExtendsStack.length-1], selectorsToAdd = [], extendVisitor = this, selectorPath;
8360
+ var matches, pathIndex, extendIndex, allExtends = this.allExtendsStack[this.allExtendsStack.length - 1],
8361
+ selectorsToAdd = [], extendVisitor = this, selectorPath;
8251
8362
 
8252
8363
  // look at each selector path in the ruleset, find any extend matches and then copy, find and replace
8253
8364
 
@@ -8257,7 +8368,7 @@ ProcessExtendsVisitor.prototype = {
8257
8368
 
8258
8369
  // extending extends happens initially, before the main pass
8259
8370
  if (rulesetNode.extendOnEveryPath) { continue; }
8260
- var extendList = selectorPath[selectorPath.length-1].extendList;
8371
+ var extendList = selectorPath[selectorPath.length - 1].extendList;
8261
8372
  if (extendList && extendList.length) { continue; }
8262
8373
 
8263
8374
  matches = this.findMatch(allExtends[extendIndex], selectorPath);
@@ -8294,15 +8405,16 @@ ProcessExtendsVisitor.prototype = {
8294
8405
 
8295
8406
  // if we allow elements before our match we can add a potential match every time. otherwise only at the first element.
8296
8407
  if (extend.allowBefore || (haystackSelectorIndex === 0 && hackstackElementIndex === 0)) {
8297
- potentialMatches.push({pathIndex: haystackSelectorIndex, index: hackstackElementIndex, matched: 0, initialCombinator: haystackElement.combinator});
8408
+ potentialMatches.push({pathIndex: haystackSelectorIndex, index: hackstackElementIndex, matched: 0,
8409
+ initialCombinator: haystackElement.combinator});
8298
8410
  }
8299
8411
 
8300
8412
  for(i = 0; i < potentialMatches.length; i++) {
8301
8413
  potentialMatch = potentialMatches[i];
8302
8414
 
8303
8415
  // selectors add " " onto the first element. When we use & it joins the selectors together, but if we don't
8304
- // then each selector in haystackSelectorPath has a space before it added in the toCSS phase. so we need to work out
8305
- // what the resulting combinator will be
8416
+ // then each selector in haystackSelectorPath has a space before it added in the toCSS phase. so we need to
8417
+ // work out what the resulting combinator will be
8306
8418
  targetCombinator = haystackElement.combinator.value;
8307
8419
  if (targetCombinator === '' && hackstackElementIndex === 0) {
8308
8420
  targetCombinator = ' ';
@@ -8320,7 +8432,8 @@ ProcessExtendsVisitor.prototype = {
8320
8432
  if (potentialMatch) {
8321
8433
  potentialMatch.finished = potentialMatch.matched === needleElements.length;
8322
8434
  if (potentialMatch.finished &&
8323
- (!extend.allowAfter && (hackstackElementIndex+1 < hackstackSelector.elements.length || haystackSelectorIndex+1 < haystackSelectorPath.length))) {
8435
+ (!extend.allowAfter &&
8436
+ (hackstackElementIndex + 1 < hackstackSelector.elements.length || haystackSelectorIndex + 1 < haystackSelectorPath.length))) {
8324
8437
  potentialMatch = null;
8325
8438
  }
8326
8439
  }
@@ -8366,7 +8479,7 @@ ProcessExtendsVisitor.prototype = {
8366
8479
  if (!(elementValue2 instanceof tree.Selector) || elementValue1.elements.length !== elementValue2.elements.length) {
8367
8480
  return false;
8368
8481
  }
8369
- for(var i = 0; i <elementValue1.elements.length; i++) {
8482
+ for(var i = 0; i < elementValue1.elements.length; i++) {
8370
8483
  if (elementValue1.elements[i].combinator.value !== elementValue2.elements[i].combinator.value) {
8371
8484
  if (i !== 0 || (elementValue1.elements[i].combinator.value || ' ') !== (elementValue2.elements[i].combinator.value || ' ')) {
8372
8485
  return false;
@@ -8404,7 +8517,8 @@ ProcessExtendsVisitor.prototype = {
8404
8517
  );
8405
8518
 
8406
8519
  if (match.pathIndex > currentSelectorPathIndex && currentSelectorPathElementIndex > 0) {
8407
- path[path.length - 1].elements = path[path.length - 1].elements.concat(selectorPath[currentSelectorPathIndex].elements.slice(currentSelectorPathElementIndex));
8520
+ path[path.length - 1].elements = path[path.length - 1]
8521
+ .elements.concat(selectorPath[currentSelectorPathIndex].elements.slice(currentSelectorPathElementIndex));
8408
8522
  currentSelectorPathElementIndex = 0;
8409
8523
  currentSelectorPathIndex++;
8410
8524
  }
@@ -8433,7 +8547,8 @@ ProcessExtendsVisitor.prototype = {
8433
8547
  }
8434
8548
 
8435
8549
  if (currentSelectorPathIndex < selectorPath.length && currentSelectorPathElementIndex > 0) {
8436
- path[path.length - 1].elements = path[path.length - 1].elements.concat(selectorPath[currentSelectorPathIndex].elements.slice(currentSelectorPathElementIndex));
8550
+ path[path.length - 1].elements = path[path.length - 1]
8551
+ .elements.concat(selectorPath[currentSelectorPathIndex].elements.slice(currentSelectorPathElementIndex));
8437
8552
  currentSelectorPathIndex++;
8438
8553
  }
8439
8554
 
@@ -8444,7 +8559,7 @@ ProcessExtendsVisitor.prototype = {
8444
8559
  visitRulesetOut: function (rulesetNode) {
8445
8560
  },
8446
8561
  visitMedia: function (mediaNode, visitArgs) {
8447
- var newAllExtends = mediaNode.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length-1]);
8562
+ var newAllExtends = mediaNode.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length - 1]);
8448
8563
  newAllExtends = newAllExtends.concat(this.doExtendChaining(newAllExtends, mediaNode.allExtends));
8449
8564
  this.allExtendsStack.push(newAllExtends);
8450
8565
  },
@@ -8454,7 +8569,7 @@ ProcessExtendsVisitor.prototype = {
8454
8569
  this.allExtendsStack.length = lastIndex;
8455
8570
  },
8456
8571
  visitDirective: function (directiveNode, visitArgs) {
8457
- var newAllExtends = directiveNode.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length-1]);
8572
+ var newAllExtends = directiveNode.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length - 1]);
8458
8573
  newAllExtends = newAllExtends.concat(this.doExtendChaining(newAllExtends, directiveNode.allExtends));
8459
8574
  this.allExtendsStack.push(newAllExtends);
8460
8575
  },
@@ -8610,7 +8725,8 @@ ImportVisitor.prototype = {
8610
8725
  var onImported = this.onImported.bind(this, evaldImportNode, context),
8611
8726
  sequencedOnImported = this._sequencer.addImport(onImported);
8612
8727
 
8613
- this._importer.push(evaldImportNode.getPath(), tryAppendLessExtension, evaldImportNode.currentFileInfo, evaldImportNode.options, sequencedOnImported);
8728
+ this._importer.push(evaldImportNode.getPath(), tryAppendLessExtension, evaldImportNode.currentFileInfo,
8729
+ evaldImportNode.options, sequencedOnImported);
8614
8730
  } else {
8615
8731
  this.importCount--;
8616
8732
  if (this.isFinished) {
@@ -8814,7 +8930,7 @@ ToCSSVisitor.prototype = {
8814
8930
  // be considered illegal css as it has to be on the first line
8815
8931
  if (this.charset) {
8816
8932
  if (directiveNode.debugInfo) {
8817
- var comment = new tree.Comment("/* " + directiveNode.toCSS(this._context).replace(/\n/g, "")+" */\n");
8933
+ var comment = new tree.Comment("/* " + directiveNode.toCSS(this._context).replace(/\n/g, "") + " */\n");
8818
8934
  comment.debugInfo = directiveNode.debugInfo;
8819
8935
  return this._visitor.visit(comment);
8820
8936
  }
@@ -8838,7 +8954,7 @@ ToCSSVisitor.prototype = {
8838
8954
  }
8839
8955
 
8840
8956
  //the directive was not directly referenced
8841
- for (var r = 0; r<directiveNode.rules.rules.length; r++) {
8957
+ for (var r = 0; r < directiveNode.rules.rules.length; r++) {
8842
8958
  var rule = directiveNode.rules.rules[r];
8843
8959
  if (rule.getIsReferenced && rule.getIsReferenced()) {
8844
8960
  //the directive contains something that was referenced (likely by extend)
@@ -8853,8 +8969,9 @@ ToCSSVisitor.prototype = {
8853
8969
  //was referenced. Therefore it must not be shown in output.
8854
8970
  return ;
8855
8971
  } else {
8856
- if (!directiveNode.getIsReferenced())
8972
+ if (!directiveNode.getIsReferenced()) {
8857
8973
  return;
8974
+ }
8858
8975
  }
8859
8976
  return directiveNode;
8860
8977
  },
@@ -9015,7 +9132,7 @@ ToCSSVisitor.prototype = {
9015
9132
  var spacedGroups = [];
9016
9133
  var lastSpacedGroup = [];
9017
9134
  parts.map(function (p) {
9018
- if (p.merge==="+") {
9135
+ if (p.merge === "+") {
9019
9136
  if (lastSpacedGroup.length > 0) {
9020
9137
  spacedGroups.push(toExpression(lastSpacedGroup));
9021
9138
  }