Skip to content
New issue

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

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

Already on GitHub? # to your account

Add origin value as data-value to built html elements #2972

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion coffee/chosen.jquery.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ class Chosen extends AbstractChosen
this.result_clear_highlight() if $(evt.target).hasClass("active-result") or $(evt.target).parents('.active-result').first()

choice_build: (item) ->
choice = $('<li />', { class: "search-choice" }).html("<span>#{this.choice_label(item)}</span>")
choice = $('<li />', { class: "search-choice", "data-value": item.value }).html("<span>#{this.choice_label(item)}</span>")

if item.disabled
choice.addClass 'search-choice-disabled'
Expand Down
2 changes: 1 addition & 1 deletion coffee/chosen.proto.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ class @Chosen extends AbstractChosen
this.result_clear_highlight() if evt.target.hasClassName('active-result') or evt.target.up('.active-result')

choice_build: (item) ->
choice = new Element('li', { class: "search-choice" }).update("<span>#{this.choice_label(item)}</span>")
choice = new Element('li', { class: "search-choice", "data-value": item.value }).update("<span>#{this.choice_label(item)}</span>")

if item.disabled
choice.addClassName 'search-choice-disabled'
Expand Down
1 change: 1 addition & 0 deletions coffee/lib/abstract-chosen.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ class AbstractChosen
option_el.setAttribute("data-option-array-index", option.array_index)
option_el.innerHTML = option.highlighted_html or option.html
option_el.title = option.title if option.title
option_el.setAttribute("data-value", option.value);

this.outerHTML(option_el)

Expand Down