8000 remove shallow/deep options & tidy up part 1 · nullstring/less.js@cf9496e · GitHub
[go: up one dir, main page]

Skip to content

Commit cf9496e

Browse files
committed
remove shallow/deep options & tidy up part 1
1 parent c139c6e commit cf9496e

File tree

5 files changed

+7
-116
lines changed

5 files changed

+7
-116
lines changed

lib/less/extend-visitor.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@
157157
for(k = 0; k < selectorPath.length; k++) {
158158
selector = selectorPath[k];
159159
for(i = 0; i < selector.elements.length; i++) {
160-
if (extend.any || (k == 0 && i == 0)) {
160+
if (extend.allowBefore || (k == 0 && i == 0)) {
161161
potentialMatches.push({pathIndex: k, index: i, matched: 0, initialCombinator: selector.elements[i].combinator});
162162
}
163163

@@ -178,7 +178,7 @@
178178
if (potentialMatch) {
179179
potentialMatch.finished = potentialMatch.matched === extend.selector.elements.length;
180180
if (potentialMatch.finished &&
181-
(!extend.deep && (i+1 < selector.elements.length ||
181+
(!extend.allowAfter && (i+1 < selector.elements.length ||
182182
k+1 < selectorPath.length))) {
183183
potentialMatch = null;
184184
}

lib/less/parser.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -794,7 +794,7 @@ less.Parser = function Parser(env) {
794794
if (!$(isRule ? /^&:extend\(/ : /^:extend\(/)) { return; }
795795

796796
while (true) {
797-
option = $(/^(any|deep|all)(?=\s*\))/);
797+
option = $(/^(all)(?=\s*\))/);
798798
if (option) { break; }
799799
e = $(this.element);
800800
if (!e) { break; }

lib/less/tree/extend.js

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,12 @@ tree.Extend = function Extend(selector, option, index) {
77

88
switch(option) {
99
case "all":
10-
this.deep = true;
11-
this.any = true;
12-
break;
13-
case "deep":
14-
this.deep = true;
15-
this.any = false;
16-
break;
17-
case "any":
18-
this.deep = false;
19-
this.any = true;
10+
this.allowBefore = true;
11+
this.allowAfter = true;
2012
break;
2113
default:
22-
this.deep = false;
23-
this.any = false;
14+
this.allowBefore = false;
15+
this.allowAfter = false;
2416
break;
2517
}
2618
};

test/css/extend-deep.css

Lines changed: 0 additions & 49 deletions
This file was deleted.

test/less/extend-deep.less

Lines changed: 0 additions & 52 deletions
This file was deleted.

0 commit comments

Comments
 (0)
0