Permalink
Browse files

Fix bug by using more specific selectors.

  • Loading branch information...
1 parent 3d4861a commit 4faa696d2ae5338fc7dcb69876b516438e44aaf4 @ordinaryzelig committed Apr 11, 2012
Showing with 20 additions and 8 deletions.
  1. +12 −0 CHANGELOG.md
  2. +4 −4 src/jquery-selectTagAutocompleteFloater.coffee
  3. +4 −4 src/jquery-selectTagAutocompleteFloater.js
View
@@ -1,5 +1,17 @@
# CHANGELOG
+## v0.0.4 2012-04-10
+
+### Bug fixes
+
+* Use more specific selectors than `siblings()` like `nextAll()`
+
+## v0.0.3 2012-04-10
+
+### Bug fixes
+
+* Set `$` to `jquery`.
+
## v0.0.2 2012-04-10
### Minor features
@@ -1,7 +1,7 @@
'========================='
'autocompleteFloater'
''
-'v0.0.3'
+'v0.0.4'
''
'https://github.com/ordinaryzelig/jquery-autocompleteFloater'
'This software is offered as is without warranty, yada yada.'
@@ -49,7 +49,7 @@ autocompleteFloaterFunctions = {
)
link.click (event) ->
event.preventDefault()
- floater = $(@).next('.autocompleteFloater')
+ floater = $(@).nextAll('.autocompleteFloater:first')
floater.toggle()
if floater.is(':visible')
textField = floater.children('input:text')
@@ -66,14 +66,14 @@ autocompleteFloaterFunctions = {
$(@).html()
).get()
# Add jQuery autocomplete to text field.
- textField = selectTag.siblings('.autocompleteFloater').children('input:text')
+ textField = selectTag.nextAll('.autocompleteFloater:first').children('input:text')
textField.autocomplete
source: optionStrings
select: (event, ui) ->
# Find the matching option in the select tag and change it to selected.
selected = ui.item.value
floater = $(@).parents('.autocompleteFloater')
- selectTag = floater.siblings('select')
+ selectTag = floater.prevAll('select:first')
# Iterate through each option.
# When matching option found, select it in the select tag.
selectTag.children('option').each ->
@@ -2,7 +2,7 @@
'=========================';
'autocompleteFloater';
'';
- 'v0.0.3';
+ 'v0.0.4';
'';
'https://github.com/ordinaryzelig/jquery-autocompleteFloater';
'This software is offered as is without warranty, yada yada.';
@@ -42,7 +42,7 @@
link.click(function(event) {
var floater, textField;
event.preventDefault();
- floater = $(this).next('.autocompleteFloater');
+ floater = $(this).nextAll('.autocompleteFloater:first');
floater.toggle();
if (floater.is(':visible')) {
textField = floater.children('input:text');
@@ -57,14 +57,14 @@
optionStrings = selectTag.children('option').map(function() {
return $(this).html();
}).get();
- textField = selectTag.siblings('.autocompleteFloater').children('input:text');
+ textField = selectTag.nextAll('.autocompleteFloater:first').children('input:text');
return textField.autocomplete({
source: optionStrings,
select: function(event, ui) {
var floater, selected;
selected = ui.item.value;
floater = $(this).parents('.autocompleteFloater');
- selectTag = floater.siblings('select');
+ selectTag = floater.prevAll('select:first');
selectTag.children('option').each(function() {
var option;
option = $(this);

0 comments on commit 4faa696

Please sign in to comment.