Skip to content

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

Open

Description

@Goszu

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions