aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Curry <matt@pseudocoder.com>2010-01-23 12:52:32 -0500
committerjeresig <jeresig@gmail.com>2010-01-23 12:52:32 -0500
commitf6ec9d54d11432b91577addab6e613fb1f7a5203 (patch)
tree45d2f061e44f3e1cc60ab1bcc7b7e67dbaa6bb8f
parent28ce15979f69903f2fe1187705b190968757ddf7 (diff)
downloadjquery-f6ec9d54d11432b91577addab6e613fb1f7a5203.tar.gz
jquery-f6ec9d54d11432b91577addab6e613fb1f7a5203.zip
Select (with a selected) fired change on first focus in IE. Fixes #5869.
-rw-r--r--src/event.js8
-rw-r--r--test/delegatetest.html5
2 files changed, 9 insertions, 4 deletions
diff --git a/src/event.js b/src/event.js
index 0128dc599..7a27fb812 100644
--- a/src/event.js
+++ b/src/event.js
@@ -661,14 +661,14 @@ function testChange( e ) {
data = jQuery.data( elem, "_change_data" );
val = getVal(elem);
- if ( val === data ) {
- return;
- }
-
// the current data will be also retrieved by beforeactivate
if ( e.type !== "focusout" || elem.type !== "radio" ) {
jQuery.data( elem, "_change_data", val );
}
+
+ if ( data === undefined || val === data ) {
+ return;
+ }
if ( data != null || val ) {
e.type = "change";
diff --git a/test/delegatetest.html b/test/delegatetest.html
index 5e2cd82ac..1a785a306 100644
--- a/test/delegatetest.html
+++ b/test/delegatetest.html
@@ -21,6 +21,11 @@
<option value='two'>change me 2</option>
<option value='three'>change me 3</option>
</select>
+ <select class='select_test'>
+ <option value='one'>change me 1</option>
+ <option value='two' selected="selected">change me 2</option>
+ <option value='three'>change me 3</option>
+ </select>
</td>
<td>
<select class='mselect_test' multiple="multiple">