Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin (populating selectbox) iterates trough not own array properties #30

Open
Goszu opened this issue Feb 3, 2012 · 0 comments
Open

Comments

@Goszu
Copy link

Goszu commented Feb 3, 2012

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
marcingosz@gmail.com

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant