mirror of
https://github.com/less/less.js.git
synced 2026-04-09 03:00:20 -04:00
Fix for in without hasOwnProperty
This commit is contained in:
@@ -41,7 +41,9 @@ less.poll = less.poll || (isFileProtocol ? 1000 : 1500);
|
||||
//Setup user functions
|
||||
if (less.functions) {
|
||||
for(var func in less.functions) {
|
||||
less.tree.functions[func] = less.functions[func];
|
||||
if (less.functions.hasOwnProperty(func)) {
|
||||
less.tree.functions[func] = less.functions[func];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -671,12 +671,16 @@ function initFunctions() {
|
||||
|
||||
// math
|
||||
for (f in mathFunctions) {
|
||||
tf[f] = _math.bind(null, Math[f], mathFunctions[f]);
|
||||
if (mathFunctions.hasOwnProperty(f)) {
|
||||
tf[f] = _math.bind(null, Math[f], mathFunctions[f]);
|
||||
}
|
||||
}
|
||||
|
||||
// color blending
|
||||
for (f in colorBlendMode) {
|
||||
tf[f] = colorBlend.bind(null, colorBlendMode[f]);
|
||||
if (colorBlendMode.hasOwnProperty(f)) {
|
||||
tf[f] = colorBlend.bind(null, colorBlendMode[f]);
|
||||
}
|
||||
}
|
||||
|
||||
// default
|
||||
|
||||
@@ -224,4 +224,4 @@ require('./join-selector-visitor.js');
|
||||
require('./to-css-visitor.js');
|
||||
require('./source-map-output.js');
|
||||
|
||||
for (var k in less) { exports[k] = less[k]; }
|
||||
for (var k in less) { if (less.hasOwnProperty(k)) { exports[k] = less[k]; }}
|
||||
|
||||
@@ -79,4 +79,4 @@ var lessc_helper = {
|
||||
};
|
||||
|
||||
// Exports helper functions
|
||||
for (var h in lessc_helper) { exports[h] = lessc_helper[h]; }
|
||||
for (var h in lessc_helper) { if (lessc_helper.hasOwnProperty(h)) { exports[h] = lessc_helper[h]; }}
|
||||
|
||||
@@ -101,11 +101,14 @@
|
||||
|
||||
if (this._outputSourceFiles) {
|
||||
for(var filename in this._contentsMap) {
|
||||
var source = this._contentsMap[filename];
|
||||
if (this._contentsIgnoredCharsMap[filename]) {
|
||||
source = source.slice(this._contentsIgnoredCharsMap[filename]);
|
||||
if (this._contentsMap.hasOwnProperty(filename))
|
||||
{
|
||||
var source = this._contentsMap[filename];
|
||||
if (this._contentsIgnoredCharsMap[filename]) {
|
||||
source = source.slice(this._contentsIgnoredCharsMap[filename]);
|
||||
}
|
||||
this._sourceMapGenerator.setSourceContent(this.normalizeFilename(filename), source);
|
||||
}
|
||||
this._sourceMapGenerator.setSourceContent(this.normalizeFilename(filename), source);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,14 +23,17 @@ tree.JavaScript.prototype = {
|
||||
index: this.index };
|
||||
}
|
||||
|
||||
for (var k in env.frames[0].variables()) {
|
||||
/*jshint loopfunc:true */
|
||||
context[k.slice(1)] = {
|
||||
value: env.frames[0].variables()[k].value,
|
||||
toJS: function () {
|
||||
return this.value.eval(env).toCSS();
|
||||
}
|
||||
};
|
||||
var variables = env.frames[0].variables();
|
||||
for (var k in variables) {
|
||||
if (variables.hasOwnProperty(k)) {
|
||||
/*jshint loopfunc:true */
|
||||
context[k.slice(1)] = {
|
||||
value: variables[k].value,
|
||||
toJS: function () {
|
||||
return this.value.eval(env).toCSS();
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
@@ -87,7 +87,7 @@ tree.mixin.Call.prototype = {
|
||||
|
||||
defaultFunc.reset();
|
||||
|
||||
for (m in candidates) {
|
||||
for (m = 0; m < candidates.length; m++) {
|
||||
candidate = candidates[m];
|
||||
if (!candidate.matchIfDefault || (candidate.matchIfDefaultValue == (candidates.length == 1))) {
|
||||
try {
|
||||
|
||||
@@ -11,18 +11,20 @@
|
||||
// add .typeIndex to tree node types for lookup table
|
||||
var key, child;
|
||||
for (key in parent) {
|
||||
child = parent[key];
|
||||
switch (typeof child) {
|
||||
case "function":
|
||||
// ignore bound functions directly on tree which do not have a prototype
|
||||
// or aren't nodes
|
||||
if (child.prototype && child.prototype.type) {
|
||||
child.prototype.typeIndex = ticker++;
|
||||
}
|
||||
break;
|
||||
case "object":
|
||||
ticker = indexNodeTypes(child, ticker);
|
||||
break;
|
||||
if (parent.hasOwnProperty(key)) {
|
||||
child = parent[key];
|
||||
switch (typeof child) {
|
||||
case "function":
|
||||
// ignore bound functions directly on tree which do not have a prototype
|
||||
// or aren't nodes
|
||||
if (child.prototype && child.prototype.type) {
|
||||
child.prototype.typeIndex = ticker++;
|
||||
}
|
||||
break;
|
||||
case "object":
|
||||
ticker = indexNodeTypes(child, ticker);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return ticker;
|
||||
|
||||
Reference in New Issue
Block a user