mirror of
https://github.com/less/less.js.git
synced 2026-04-09 03:00:20 -04:00
Merge pull request #2217 from seven-phases-max/2_0_0
Fix interpolated selector match regression
This commit is contained in:
@@ -50,41 +50,23 @@ Selector.prototype.match = function (other) {
|
||||
|
||||
return olen; // return number of matched elements
|
||||
};
|
||||
Selector.prototype.CacheElements = function(){
|
||||
var css = '', len, v, i;
|
||||
Selector.prototype.CacheElements = function() {
|
||||
if (this._elements)
|
||||
return;
|
||||
|
||||
var elements = this.elements.map( function(v) {
|
||||
return v.combinator.value + (v.value.value || v.value);
|
||||
}).join("").match(/[,&#\*\.\w-]([\w-]|(\\.))*/g);
|
||||
|
||||
if( !this._elements ){
|
||||
|
||||
len = this.elements.length;
|
||||
for(i = 0; i < len; i++){
|
||||
|
||||
v = this.elements[i];
|
||||
css += v.combinator.value;
|
||||
|
||||
if( !v.value.value ){
|
||||
css += v.value;
|
||||
continue;
|
||||
}
|
||||
|
||||
if( typeof v.value.value !== "string" ){
|
||||
css = '';
|
||||
break;
|
||||
}
|
||||
css += v.value.value;
|
||||
if (elements) {
|
||||
if (elements[0] === "&") {
|
||||
elements.shift();
|
||||
}
|
||||
|
||||
this._elements = css.match(/[,&#\*\.\w-]([\w-]|(\\.))*/g);
|
||||
|
||||
if (this._elements) {
|
||||
if (this._elements[0] === "&") {
|
||||
this._elements.shift();
|
||||
}
|
||||
|
||||
} else {
|
||||
this._elements = [];
|
||||
}
|
||||
|
||||
} else {
|
||||
elements = [];
|
||||
}
|
||||
|
||||
this._elements = elements;
|
||||
};
|
||||
Selector.prototype.isJustParentSelector = function() {
|
||||
return !this.mediaEmpty &&
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
.123 {
|
||||
a: 0;
|
||||
}
|
||||
.foo {
|
||||
a: 1;
|
||||
}
|
||||
@@ -11,6 +14,7 @@
|
||||
a: 4;
|
||||
}
|
||||
mi-test-a {
|
||||
a: 0;
|
||||
a: 1;
|
||||
a: 2;
|
||||
a: 3;
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
|
||||
@a0: 123;
|
||||
@a1: foo;
|
||||
@a2: ~".foo";
|
||||
@a4: ~"#foo";
|
||||
|
||||
.@{a0} {
|
||||
a: 0;
|
||||
}
|
||||
|
||||
.@{a1} {
|
||||
a: 1;
|
||||
}
|
||||
@@ -20,6 +25,7 @@
|
||||
}
|
||||
|
||||
mi-test-a {
|
||||
.123;
|
||||
.foo;
|
||||
#foo;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user