aboutsummaryrefslogtreecommitdiffstats
path: root/ui/jquery.ui.button.js
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2010-03-11 03:50:20 +0000
committerScott González <scott.gonzalez@gmail.com>2010-03-11 03:50:20 +0000
commitfe6bef16e40c6e1847f26e20630914c42a6fb8cf (patch)
tree28f39c6139212a8a9078b4a3837bcf981140baae /ui/jquery.ui.button.js
parent5df420eab3a070df183002866f1f980a00dace64 (diff)
downloadjquery-ui-fe6bef16e40c6e1847f26e20630914c42a6fb8cf.tar.gz
jquery-ui-fe6bef16e40c6e1847f26e20630914c42a6fb8cf.zip
Button: Support elements that are disconnected from the DOM.
Fixes #5246 - _determineButtonType does not work if a label for checkbox/radiobutton is not yet attached to the document.
Diffstat (limited to 'ui/jquery.ui.button.js')
-rw-r--r--ui/jquery.ui.button.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/ui/jquery.ui.button.js b/ui/jquery.ui.button.js
index f387932c3..14b8a6504 100644
--- a/ui/jquery.ui.button.js
+++ b/ui/jquery.ui.button.js
@@ -158,7 +158,10 @@ $.widget( "ui.button", {
: "button";
if ( this.type === "checkbox" || this.type === "radio" ) {
- this.buttonElement = $( "[for=" + this.element.attr("id") + "]" );
+ // we don't search against the document in case the element
+ // is disconnected from the DOM
+ this.buttonElement = this.element.parents().last()
+ .find( "[for=" + this.element.attr("id") + "]" );
this.element.addClass('ui-helper-hidden-accessible');
var checked = this.element.is( ":checked" );