Skip to content

Commit 71777a1

Browse files
committed
References #89
1 parent a261b77 commit 71777a1

File tree

5 files changed

+28
-14
lines changed

5 files changed

+28
-14
lines changed

demos/default.html

-6
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,6 @@
5454
$(function() {
5555
window.selectBox = $("#test").selectBoxIt().data("selectBoxIt");
5656

57-
$('#test').bind("destroy", function() {
58-
59-
console.log('select box destroy event triggered');
60-
61-
});
62-
6357
$('#test1').selectBoxIt({theme: "jqueryui"}).data("selectBoxIt");
6458

6559
});

src/javascripts/jquery.selectBoxIt.core.js

+13-3
Original file line numberDiff line numberDiff line change
@@ -842,14 +842,19 @@
842842
// Shows the dropdown list options list
843843
self.open();
844844
}
845+
845846
}
847+
846848
},
847849

848850
// `mousedown` event with the `selectBoxIt` namespace
849851
"mousedown.selectBoxIt": function() {
850852

851853
// Stores data in the jQuery `data` method to help determine if the dropdown list gains focus from a click or tabstop. The mousedown event fires before the focus event.
852854
$(this).data("mdown", true);
855+
856+
self.triggerEvent("mousedown");
857+
853858
},
854859

855860
// `blur` event with the `selectBoxIt` namespace. Uses special blur logic to make sure the dropdown list closes correctly
@@ -866,10 +871,14 @@
866871

867872
//If the dropdown options list is visible
868873
if (self.list.is(":visible")) {
874+
869875
//Closes the dropdown list options list
870876
self.close();
877+
871878
}
879+
872880
}
881+
873882
},
874883

875884
"focus.selectBoxIt": function(event, internal) {
@@ -888,7 +897,7 @@
888897
// Triggers the `tabFocus` custom event on the original select box
889898
self.triggerEvent("tab-focus");
890899

891-
}, 0);
900+
});
892901

893902
}
894903

@@ -1663,8 +1672,9 @@
16631672
// Finds the currently option index
16641673
currentIndex = self.options["showFirstOption"] ? self.currentFocus : ((self.currentFocus - 1) >= 0 ? self.currentFocus: 0 );
16651674

1666-
// Triggers the custom option-click event on the original select box and passes the select box option
1667-
self.selectBox.trigger(eventName, { "elem": self.selectBox.eq(currentIndex), "dropdown-elem": self.listItems.eq(self.currentFocus) });
1675+
// Triggers the custom option-click event on the original select box and passes the select box option
1676+
self.selectBox.trigger(eventName, { "elem": self.selectBox.eq(currentIndex), "dropdown-elem": self.listItems.eq(self.currentFocus) });
1677+
16681678

16691679
// Maintains chainability
16701680
return self;

src/javascripts/jquery.selectBoxIt.core.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/javascripts/jquery.selectBoxIt.js

+13-3
Original file line numberDiff line numberDiff line change
@@ -842,14 +842,19 @@
842842
// Shows the dropdown list options list
843843
self.open();
844844
}
845+
845846
}
847+
846848
},
847849

848850
// `mousedown` event with the `selectBoxIt` namespace
849851
"mousedown.selectBoxIt": function() {
850852

851853
// Stores data in the jQuery `data` method to help determine if the dropdown list gains focus from a click or tabstop. The mousedown event fires before the focus event.
852854
$(this).data("mdown", true);
855+
856+
self.triggerEvent("mousedown");
857+
853858
},
854859

855860
// `blur` event with the `selectBoxIt` namespace. Uses special blur logic to make sure the dropdown list closes correctly
@@ -866,10 +871,14 @@
866871

867872
//If the dropdown options list is visible
868873
if (self.list.is(":visible")) {
874+
869875
//Closes the dropdown list options list
870876
self.close();
877+
871878
}
879+
872880
}
881+
873882
},
874883

875884
"focus.selectBoxIt": function(event, internal) {
@@ -888,7 +897,7 @@
888897
// Triggers the `tabFocus` custom event on the original select box
889898
self.triggerEvent("tab-focus");
890899

891-
}, 0);
900+
});
892901

893902
}
894903

@@ -1663,8 +1672,9 @@
16631672
// Finds the currently option index
16641673
currentIndex = self.options["showFirstOption"] ? self.currentFocus : ((self.currentFocus - 1) >= 0 ? self.currentFocus: 0 );
16651674

1666-
// Triggers the custom option-click event on the original select box and passes the select box option
1667-
self.selectBox.trigger(eventName, { "elem": self.selectBox.eq(currentIndex), "dropdown-elem": self.listItems.eq(self.currentFocus) });
1675+
// Triggers the custom option-click event on the original select box and passes the select box option
1676+
self.selectBox.trigger(eventName, { "elem": self.selectBox.eq(currentIndex), "dropdown-elem": self.listItems.eq(self.currentFocus) });
1677+
16681678

16691679
// Maintains chainability
16701680
return self;

src/javascripts/jquery.selectBoxIt.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)