remove shallow/deep options & tidy up part 1

This commit is contained in:
Luke Page
2013-03-06 08:03:50 +00:00
parent c139c6e4df
commit cf9496ec32
5 changed files with 7 additions and 116 deletions

View File

@@ -157,7 +157,7 @@
for(k = 0; k < selectorPath.length; k++) {
selector = selectorPath[k];
for(i = 0; i < selector.elements.length; i++) {
if (extend.any || (k == 0 && i == 0)) {
if (extend.allowBefore || (k == 0 && i == 0)) {
potentialMatches.push({pathIndex: k, index: i, matched: 0, initialCombinator: selector.elements[i].combinator});
}
@@ -178,7 +178,7 @@
if (potentialMatch) {
potentialMatch.finished = potentialMatch.matched === extend.selector.elements.length;
if (potentialMatch.finished &&
(!extend.deep && (i+1 < selector.elements.length ||
(!extend.allowAfter && (i+1 < selector.elements.length ||
k+1 < selectorPath.length))) {
potentialMatch = null;
}

View File

@@ -794,7 +794,7 @@ less.Parser = function Parser(env) {
if (!$(isRule ? /^&:extend\(/ : /^:extend\(/)) { return; }
while (true) {
option = $(/^(any|deep|all)(?=\s*\))/);
option = $(/^(all)(?=\s*\))/);
if (option) { break; }
e = $(this.element);
if (!e) { break; }

View File

@@ -7,20 +7,12 @@ tree.Extend = function Extend(selector, option, index) {
switch(option) {
case "all":
this.deep = true;
this.any = true;
break;
case "deep":
this.deep = true;
this.any = false;
break;
case "any":
this.deep = false;
this.any = true;
this.allowBefore = true;
this.allowAfter = true;
break;
default:
this.deep = false;
this.any = false;
this.allowBefore = false;
this.allowAfter = false;
break;
}
};

View File

@@ -1,49 +0,0 @@
.replace.replace .replace,
.c.replace + .replace .replace,
.replace.replace .c,
.c.replace + .replace .c,
.rep_ace,
.effected.replace + .replace .replace,
.effected.replace + .replace .c {
prop: copy-paste-replace;
}
.replace.replace .replace .d,
.c.replace + .replace .replace .d,
.replace.replace .c .d,
.c.replace + .replace .c .d,
.rep_ace .d,
.effected.replace + .replace .replace .d,
.effected.replace + .replace .c .d {
prop: deep;
}
.a .b .c,
.effected .b .c {
prop: is_effected;
}
.a,
.effected {
prop: is_effected;
}
.a .b,
.effected .b {
prop: is_effected;
}
.a .b.c,
.effected .b.c {
prop: is_effected;
}
.b .a {
prop: not_effected;
}
.a:hover,
.effected:hover {
hover: is_effected;
}
.e.e,
.dbl {
prop: extend-double;
}
.e.e:hover,
.dbl:hover {
hover: up;
}

View File

@@ -1,52 +0,0 @@
.replace.replace,
.c.replace + .replace {
.replace,
.c {
prop: copy-paste-replace;
.d {
prop: deep;
}
}
}
.rep_ace:extend(.replace.replace .replace deep) {}
.a .b .c {
prop: is_effected;
}
.a {
prop: is_effected;
.b {
prop: is_effected;
}
.b.c {
prop: is_effected;
}
}
.b {
.a {
prop: not_effected;
}
}
.a {
&:hover {
hover: is_effected;
}
}
.effected {
&:extend(.a deep);
&:extend(.c deep);
}
.e {
&& {
prop: extend-double;
&:hover {
hover: up;
}
}
}
.dbl:extend(.e.e deep) {}