Skip to content

Widget: fix handling of options === true under use strict in _show/_hide #1931

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 6, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions ui/widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -717,6 +717,8 @@ $.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) {
options = options || {};
if ( typeof options === "number" ) {
options = { duration: options };
} else if ( options === true ) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When is true allowed for options? Is there a current test that fails without this? If not, could you add one?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For me it was happening in tooltip with default show/hide option which is true
https://api.jqueryui.com/1.12/tooltip/#option-show
https://api.jqueryui.com/1.12/tooltip/#option-hide
this gets passed to the function.

Note that this is under "use strict" only, without use strict it just eats it up... I didn't run the tests, and I think adding one would be too much for me atm

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you have a code example that shows the problem? It's still not clear to me how this would occur.

Copy link
Contributor Author

@Interghost Interghost Jul 29, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://jsfiddle.net/fgLoq65n/
Note I had to paste the entire UI in the JS editor so it will take some time to load, just be patient... after load (when JS code gets colored) open console and mouseover the input box

options = {};
}

hasOptions = !$.isEmptyObject( options );
Expand Down