mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Button: Read disabled attribute from original element if disabled option is null. Fixes #5252 -Button: read disabled option from input elements.
This commit is contained in:
parent
9060bf3d09
commit
2838c11ea8
@ -3,7 +3,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
var button_defaults = {
|
var button_defaults = {
|
||||||
disabled: false,
|
disabled: null,
|
||||||
text: true,
|
text: true,
|
||||||
label: null,
|
label: null,
|
||||||
icons: {
|
icons: {
|
||||||
|
@ -5,6 +5,30 @@
|
|||||||
|
|
||||||
module("button: options");
|
module("button: options");
|
||||||
|
|
||||||
|
test("disabled, explicity value", function() {
|
||||||
|
$("#radio01").button({ disabled: false });
|
||||||
|
same(false, $("#radio01").button("option", "disabled"),
|
||||||
|
"disabled option set to false");
|
||||||
|
same(false, $("#radio01").attr("disabled"), "element is disabled");
|
||||||
|
|
||||||
|
$("#radio02").button({ disabled: true });
|
||||||
|
same(true, $("#radio02").button("option", "disabled"),
|
||||||
|
"disabled option set to true");
|
||||||
|
same(true, $("#radio02").attr("disabled"), "element is not disabled");
|
||||||
|
});
|
||||||
|
|
||||||
|
test("disabled, null", function() {
|
||||||
|
$("#radio01").button({ disabled: null });
|
||||||
|
same(false, $("#radio01").button("option", "disabled"),
|
||||||
|
"disabled option set to false");
|
||||||
|
same(false, $("#radio01").attr("disabled"), "element is disabled");
|
||||||
|
|
||||||
|
$("#radio02").attr("disabled", "disabled").button({ disabled: null });
|
||||||
|
same(true, $("#radio02").button("option", "disabled"),
|
||||||
|
"disabled option set to true");
|
||||||
|
same(true, $("#radio02").attr("disabled"), "element is not disabled");
|
||||||
|
});
|
||||||
|
|
||||||
test("text false without icon", function() {
|
test("text false without icon", function() {
|
||||||
$("#button").button({
|
$("#button").button({
|
||||||
text: false
|
text: false
|
||||||
|
5
ui/jquery.ui.button.js
vendored
5
ui/jquery.ui.button.js
vendored
@ -44,6 +44,7 @@ var lastActive,
|
|||||||
|
|
||||||
$.widget( "ui.button", {
|
$.widget( "ui.button", {
|
||||||
options: {
|
options: {
|
||||||
|
disabled: null,
|
||||||
text: true,
|
text: true,
|
||||||
label: null,
|
label: null,
|
||||||
icons: {
|
icons: {
|
||||||
@ -56,6 +57,10 @@ $.widget( "ui.button", {
|
|||||||
.unbind( "reset.button" )
|
.unbind( "reset.button" )
|
||||||
.bind( "reset.button", formResetHandler );
|
.bind( "reset.button", formResetHandler );
|
||||||
|
|
||||||
|
if ( typeof this.options.disabled !== "boolean" ) {
|
||||||
|
this.options.disabled = this.element.attr( "disabled" );
|
||||||
|
}
|
||||||
|
|
||||||
this._determineButtonType();
|
this._determineButtonType();
|
||||||
this.hasTitle = !!this.buttonElement.attr( "title" );
|
this.hasTitle = !!this.buttonElement.attr( "title" );
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user