jQuery-Plugins icon indicating copy to clipboard operation
jQuery-Plugins copied to clipboard

Plugin (populating selectbox) iterates trough not own array properties

Open Goszu opened this issue 13 years ago • 0 comments

Hi

I've used this plugin on a site where I've prototyped Array object: "Array.prototype.maxNum = function () {...}"

I've noticed that this property has been included in my select box when this plugin fired.

To avoid this problem, this (line no. 111 in jquery.selectboxes.js):

------------------- CODE ---------------------

for(var item in items) { add(this, item, items[item], sO, startindex); startindex += 1; }


should have additional check if it is own property:

------------------- CODE ---------------------

for(var item in items) { if (items.hasOwnProperty(item)) { add(this, item, items[item], sO, startindex); startindex += 1; } }


Regards, Marcin Gosz [email protected]

Goszu avatar Feb 03 '12 13:02 Goszu