aboutsummaryrefslogtreecommitdiffstats
path: root/test/delegatetest.html
diff options
context:
space:
mode:
authorJörn Zaefferer <joern.zaefferer@googlemail.com>2009-12-21 16:10:21 -0500
committerjeresig <jeresig@gmail.com>2009-12-21 16:10:21 -0500
commit03481a52c72e417b01cfeb499f26738cf5ed5839 (patch)
tree549d8172bec91d9e3b8aacde3e929fdede9a5fd2 /test/delegatetest.html
parent5dc6b7ce3469eaadb37a151d449e8d36571d1894 (diff)
downloadjquery-03481a52c72e417b01cfeb499f26738cf5ed5839.tar.gz
jquery-03481a52c72e417b01cfeb499f26738cf5ed5839.zip
Stop trying to emulate the focus/blur event in IE, doesn't work as one might expect, anyway. Instead, implement the focusin/focusout events in all other browsers - which creates a much better parity across all browsers. Uses event capturing instead of bubbling to make it happen. Thanks to Alexander for the recommendation and to Joern Zaefferer for the original focus/blur delegation code.
Diffstat (limited to 'test/delegatetest.html')
-rw-r--r--test/delegatetest.html24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/delegatetest.html b/test/delegatetest.html
index e3ebbfc6e..7b35c8e0d 100644
--- a/test/delegatetest.html
+++ b/test/delegatetest.html
@@ -75,6 +75,24 @@
<td id='textbind' class="red">TEXT</td>
<td id='textareabind' class="red">TEXTAREA</td>
</tr>
+ <tr>
+ <td>Focusin:</td>
+ <td id='selectfocus' class="red">SELECT</td>
+ <td id='mselectfocus' class="red">MULTI</td>
+ <td id='checkboxfocus' class="red">CHECKBOX</td>
+ <td id='radiofocus' class="red">RADIO</td>
+ <td id='textfocus' class="red">TEXT</td>
+ <td id='textareafocus' class="red">TEXTAREA</td>
+ </tr>
+ <tr>
+ <td>Focusout:</td>
+ <td id='selectblur' class="red">SELECT</td>
+ <td id='mselectblur' class="red">MULTI</td>
+ <td id='checkboxblur' class="red">CHECKBOX</td>
+ <td id='radioblur' class="red">RADIO</td>
+ <td id='textblur' class="red">TEXT</td>
+ <td id='textareablur' class="red">TEXTAREA</td>
+ </tr>
</table>
<h2>Submit Tests</h2>
<table>
@@ -112,6 +130,12 @@
<script type='text/javascript'>
jQuery.fn.addChangeTest = function( id, prevent ) {
+ this.bind("focusin", function(){
+ jQuery(id + "focus").blink();
+ }).bind("focusout", function(){
+ jQuery(id + "blur").blink();
+ });
+
return this.bind("change", function(e){
jQuery(id + "bind").blink();
}).live("change", function(e){