mirror of
https://github.com/jquery/jquery-ui.git
synced 2025-01-07 20:34:24 +00:00
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.
This commit is contained in:
parent
5df420eab3
commit
fe6bef16e4
5
ui/jquery.ui.button.js
vendored
5
ui/jquery.ui.button.js
vendored
@ -158,7 +158,10 @@ $.widget( "ui.button", {
|
|||||||
: "button";
|
: "button";
|
||||||
|
|
||||||
if ( this.type === "checkbox" || this.type === "radio" ) {
|
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');
|
this.element.addClass('ui-helper-hidden-accessible');
|
||||||
|
|
||||||
var checked = this.element.is( ":checked" );
|
var checked = this.element.is( ":checked" );
|
||||||
|
Loading…
Reference in New Issue
Block a user