Skip to main content

Search and Top Navigation

#8028 closed bug (fixed)

Opened January 18, 2012 09:16PM UTC

Closed January 18, 2012 09:37PM UTC

Last modified January 18, 2012 09:40PM UTC

Getting unset disabled option on button widget returns jQuery object, not default value

Reported by: mikemccaughan Owned by:
Priority: minor Milestone: 1.8.18
Component: ui.button Version: 1.8.16
Keywords: Cc:
Blocked by: Blocking:
Description

I need to determine whether a button is disabled or not. I assumed that calling the option method would do it:

var disabled = $('.button').button('option', 'disabled');
if (disabled) { ... }

When run against a button which was initialized without the disabled option set, it returns the $('.button') result, rather than the default false as I expected.

See also http://jsfiddle.net/HNAf7/3/.

Attachments (0)
Change History (4)

Changed January 18, 2012 09:36PM UTC by mikemccaughan comment:1

The workaround is obviously to check for a Boolean true, but it still seems somewhat confusing, especially given using the same format for the text option does return its Boolean default value.

Changed January 18, 2012 09:37PM UTC by Scott González comment:2

resolution: → fixed
status: newclosed

Button: Properly handle disabled option on init. Fixes #8028 - Getting unset disabled option on button widget returns jQuery object, not default value.

Changeset: 3a1031e58b717b042d39dcccfdbe1d293cdbecf1

Changed January 18, 2012 09:39PM UTC by Scott González comment:3

Button: Properly handle disabled option on init. Fixes #8028 - Getting unset disabled option on button widget returns jQuery object, not default value.

(cherry picked from commit 3a1031e58b717b042d39dcccfdbe1d293cdbecf1)

Conflicts:

ui/jquery.ui.button.js

Changeset: f7f13b5949cd59f4e3f70c315d4e18f9662281ad

Changed January 18, 2012 09:40PM UTC by scottgonzalez comment:4

milestone: 1.91.8.18