Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#9601 closed bug (fixed)

Widget: calling _setOption with undefined as 3rd argument makes it a getter

Reported by: Gruewo Owned by:
Priority: minor Milestone: 1.10.4
Component: ui.widget Version: 1.10.3
Keywords: Cc:
Blocked by: Blocking:

Description

calling $('#...').widgetname('option', 'optionName', undefined) does not set the option to undefined, instead it returns the current value, which breaks method chaining, is undocumented ( http://api.jqueryui.com/jQuery.widget/#method-_setOption ) and breaks my expectation of being a setter.

See http://bugs.jquery.com/ticket/9427 for a similar issue that has been fixed some time ago.

Change History (6)

comment:1 Changed 4 years ago by tj.vantoll

Status: newopen
Summary: calling _setOption with undefined as 3rd argument makes it a getterWidget: calling _setOption with undefined as 3rd argument makes it a getter

Agree that we should probably follow the precedent from core. Test case - http://jsfiddle.net/tj_vantoll/FQPzq/.

comment:3 Changed 4 years ago by Jyoti Deka

Resolution: fixed
Status: openclosed

Widget: option-method should work as getter only when argument length is 1. Fixes #9601 - Widget: calling _setOption with undefined as 3rd argument makes it a getter

Changeset: ecde7cd41a59e9c3ff07f56baeeaec2147cca779

comment:4 Changed 4 years ago by Scott González

Milestone: none1.11.0

comment:5 Changed 4 years ago by Jyoti Deka

Widget: option-method should work as getter only when argument length is 1. Fixes #9601 - Widget: calling _setOption with undefined as 3rd argument makes it a getter (cherry picked from commit ecde7cd41a59e9c3ff07f56baeeaec2147cca779)

Changeset: 6cdebe84f8fb20374bb9dd32b62cba1b7f8dfd13

comment:6 Changed 4 years ago by Scott González

Milestone: 1.11.01.10.4
Note: See TracTickets for help on using tickets.