-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
remove use of attr(), closes #334 #1385
Changes from all commits
4885cb3
cae1786
5ef09fc
2fc521f
bd7bff9
ca141b6
1f26347
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,7 +39,7 @@ class Chosen extends AbstractChosen | |
if @is_multiple | ||
@container.html '<ul class="chzn-choices"><li class="search-field"><input type="text" value="' + @default_text + '" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chzn-drop"><ul class="chzn-results"></ul></div>' | ||
else | ||
@container.html '<a href="javascript:void(0)" class="chzn-single chzn-default" tabindex="-1"><span>' + @default_text + '</span><div><b></b></div></a><div class="chzn-drop"><div class="chzn-search"><input type="text" autocomplete="off" /></div><ul class="chzn-results"></ul></div>' | ||
@container.html '<a class="chzn-single chzn-default" tabindex="-1"><span>' + @default_text + '</span><div><b></b></div></a><div class="chzn-drop"><div class="chzn-search"><input type="text" autocomplete="off" /></div><ul class="chzn-results"></ul></div>' | ||
|
||
@form_field_jq.hide().after @container | ||
@dropdown = @container.find('div.chzn-drop').first() | ||
|
@@ -231,10 +231,10 @@ class Chosen extends AbstractChosen | |
|
||
|
||
set_tab_index: (el) -> | ||
if @form_field_jq.attr "tabindex" | ||
ti = @form_field_jq.attr "tabindex" | ||
@form_field_jq.attr "tabindex", -1 | ||
@search_field.attr "tabindex", ti | ||
if @form_field.tabIndex | ||
ti = @form_field.tabIndex | ||
@form_field.tabIndex = -1 | ||
@search_field[0].tabIndex = ti | ||
|
||
set_label_behavior: -> | ||
@form_field_label = @form_field_jq.parents("label") # first check for a parent label | ||
|
@@ -272,7 +272,7 @@ class Chosen extends AbstractChosen | |
if item.disabled | ||
choice.addClass 'search-choice-disabled' | ||
else | ||
close_link = $('<a />', { href: '#', class: 'search-choice-close', rel: item.array_index }) | ||
close_link = $('<a />', { class: 'search-choice-close', 'data-option-array-index': item.array_index }) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. One unwanted consequence of removing the Note: this is also a problem in #1377 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think a general style like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Alright, sold - add it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done! |
||
close_link.click (evt) => this.choice_destroy_link_click(evt) | ||
choice.append close_link | ||
|
||
|
@@ -284,7 +284,7 @@ class Chosen extends AbstractChosen | |
this.choice_destroy $(evt.target) unless @is_disabled | ||
|
||
choice_destroy: (link) -> | ||
if this.result_deselect (link.attr "rel") | ||
if this.result_deselect( link[0].getAttribute("data-option-array-index") ) | ||
this.show_search_field_default() | ||
|
||
this.results_hide() if @is_multiple and this.choices_count() > 0 and @search_field.val().length < 1 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,6 +29,9 @@ $chosen-sprite-retina: image-url('[email protected]'); | |
&.chzn-with-drop .chzn-drop { | ||
left: 0; | ||
} | ||
a{ | ||
cursor: pointer; | ||
} | ||
} | ||
/* @end */ | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should think about storing a reference to
@search_field
so we can move methods like this to AbstractChosen. Don't worry about doing that for this PR, though.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're probably right, also, it is confusing having a
_jq
suffix for only one jQuery element. Maybe we should have a@search_field
and@search_field_jq
, but then we actually have to change that for all elements..