我与jquery浮动工作,并且在一个功能我不能弄清楚绊(控制台日志矿):这个新创建的对象在数组中从哪里获取它的属性?
function getOrCreateAxis(axes, number) {
console.log(" ");
console.log("getOrCreateAxis starting vars:");
console.log("Axes:");
console.log(axes);
console.log("Axes -1:");
console.log(axes[number-1]);
console.log("Xaxes:");
console.log(xaxes);
console.log("options are:");
console.log(options);
if (!axes[number - 1])
axes[number - 1] = {
n: number, // save the number for future reference
direction: axes == xaxes ? "x" : "y",
options: $.extend(true, {}, axes == xaxes ? options.xaxis : options.yaxis)
};
console.log("We're done in getOrCreateAxis, axes are:" + (axes == xaxes ? "x" : "y"));
console.log(axes);
console.log(" ");
return axes[number - 1];
}
据我所知,它如果某些索引中存在接收空数组,支票,如果不是,则在该索引处创建具有属性“n”,“方向”和“选项”(从另一个数组合并而来)的新对象。
我无法弄清楚什么是所有超过三个以上从何而来,当你CONSOLE.LOG轴阵列之外的附加属性:
据我了解,有某种类型的构造函数会自动踢出填充对象的额外属性,但我无法弄清楚它来自哪里或如何触发。完整的jquery fllot代码可用here,我正在努力的功能是在980线上。
这个问题可能有点抽象,但我觉得迷失在这里,因为我甚至不知道我在找什么,技术上。什么是创造额外的属性,我在哪里可以阅读更多关于它?
你有没有试着用调试器插手? – bhspencer
我想你正在寻找[line 1837](https://github.com/flot/flot/blob/master/jquery.flot.js#L1837) – Bergi
@bhspencer是的,通过调试器逐步完成创建的对象没有其他功能叫。 – Araklaj