Commit 5c005f6b authored by David Schnur's avatar David Schnur

Wrap for...in loop bodies with hasOwnProperty.

parent e0413b93
......@@ -110,13 +110,16 @@ as "categories" on the axis object, e.g. plot.getAxes().xaxis.categories.
}
function categoriesTickGenerator(axis) {
var res = [];
for (var label in axis.categories) {
var v = axis.categories[label];
var res = [],
categories = axis.categories;
for (var label in categories) {
if (Object.prototype.hasOwnProperty.call(categories, label)) {
var v = categories[label];
if (v >= axis.min && v <= axis.max) {
res.push([v, label]);
}
}
}
res.sort(function (a, b) { return a[0] - b[0]; });
......@@ -138,9 +141,11 @@ as "categories" on the axis object, e.g. plot.getAxes().xaxis.categories.
}
else {
for (var v in o) {
if (Object.prototype.hasOwnProperty.call(o, v)) {
c[v] = o[v];
}
}
}
series[axis].categories = c;
}
......
......@@ -1552,14 +1552,16 @@ Licensed under the MIT license.
function setupGrid() {
var axes = allAxes(),
showGrid = options.grid.show,
margin = options.grid.margin || 0,
i, a;
// Initialize the plot's offset from the edge of the canvas
for (a in plotOffset) {
var margin = options.grid.margin || 0;
if (Object.prototype.hasOwnProperty.call(plotOffset, a)) {
plotOffset[a] = typeof margin === "number" ? margin : margin[a] || 0;
}
}
executeHooks(hooks.processOffset, [plotOffset]);
......
......@@ -237,6 +237,7 @@ The plugin allso adds the following methods to the plot object:
var axis, from, to, key, axes = plot.getAxes();
for (var k in axes) {
if (Object.prototype.hasOwnProperty.call(axes, k)) {
axis = axes[k];
if (axis.direction === coord) {
key = coord + axis.n + "axis";
......@@ -250,6 +251,7 @@ The plugin allso adds the following methods to the plot object:
}
}
}
}
// backwards-compat stuff - to be removed in future
if (!ranges[key]) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment