diff options
author | Richard Worth <rdworth@gmail.com> | 2010-03-11 02:09:45 +0000 |
---|---|---|
committer | Richard Worth <rdworth@gmail.com> | 2010-03-11 02:09:45 +0000 |
commit | cef16fdf78eab604ebe58526e58f962c60ab9bdb (patch) | |
tree | 153aa5e181125a671a25f77132e1c09881bca0f9 | |
parent | ac138fcb25b22594c334ab1fec2012b1598c9d3d (diff) | |
download | jquery-ui-cef16fdf78eab604ebe58526e58f962c60ab9bdb.tar.gz jquery-ui-cef16fdf78eab604ebe58526e58f962c60ab9bdb.zip |
Checkbox must not be all the way hidden for change to fire in IE. Switched out .hide() for ui-helper-hidden-accessible class instead. Fixes #5261 - button change events don't fire in IE 7/8
-rw-r--r-- | tests/visual/button/button_ticket_5261.html | 41 | ||||
-rw-r--r-- | ui/jquery.ui.button.js | 2 |
2 files changed, 42 insertions, 1 deletions
diff --git a/tests/visual/button/button_ticket_5261.html b/tests/visual/button/button_ticket_5261.html new file mode 100644 index 000000000..5f5bd19e6 --- /dev/null +++ b/tests/visual/button/button_ticket_5261.html @@ -0,0 +1,41 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <title>Button Visual Test : Button ticket #5261</title> + <link rel="stylesheet" href="../visual.css" type="text/css" /> + <link rel="stylesheet" href="../../../themes/base/jquery.ui.all.css" type="text/css"> + <script type="text/javascript" src="../../../jquery-1.4.2.js"></script> + <script type="text/javascript" src="../../../ui/jquery.ui.core.js"></script> + <script type="text/javascript" src="../../../ui/jquery.ui.widget.js"></script> + <script type="text/javascript" src="../../../ui/jquery.ui.button.js"></script> + <script type="text/javascript"> + $(function() { + + $('#id1').button().change(function(e) { + console.log('change', e); + }); + $('#id1').bind('change', function(e) { + console.log('bound change', e); + }); + $("body").live('change', function(e) { + console.log('live change on body', e); + }); + $(document).delegate('input', 'change', function(e) { + console.log('delegated input change', e); + }); + $(document).change(function(e) { + console.log('delegated change on document', e); + }); + + }); + </script> +</head> +<body> + +<h1 class="ui-widget-header"><a href="http://dev.jqueryui.com/ticket/5261">#5261 - button change events don't fire in IE 7/8</a></h1> + +<input name="1" id="id1" type="checkbox"/> +<label for="id1">Checkbox</label> + +</body> +</html> diff --git a/ui/jquery.ui.button.js b/ui/jquery.ui.button.js index fd01cf750..9c26ba529 100644 --- a/ui/jquery.ui.button.js +++ b/ui/jquery.ui.button.js @@ -159,7 +159,7 @@ $.widget( "ui.button", { if ( this.type === "checkbox" || this.type === "radio" ) { this.buttonElement = $( "[for=" + this.element.attr("id") + "]" ); - this.element.hide(); + this.element.addClass('ui-helper-hidden-accessible'); var checked = this.element.is( ":checked" ); if ( checked ) { |