Skip to content
This repository was archived by the owner on Apr 4, 2019. It is now read-only.
This repository was archived by the owner on Apr 4, 2019. It is now read-only.

Different values, same name #52

@trevorgerhardt

Description

@trevorgerhardt

I'm working with requirements that cause the select box to have options with the same name but different values.

Is there a reason behind keying the options object by name instead of value and therefore defaulting operations to .get by name?
Would it be possible to switch to value instead?
If not, would it be too confusing to add a fallback to lookup an option by value?

Append .get with something like:

var opt = this.options[name];
if (!opt) {
  each(this.options, function (k, option) {
    if (option.value === name) opt = option;
  });
}
if (!opt) throw new Error('option "' + name + '" does not exist');
return opt;

Other operations may need to updated also.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions