Widget: fix handling of options === true under use strict in _show/_hide#1931
Conversation
Fix for options === true when using jQuery UI under use strict, which throws Uncaught TypeError: Cannot create property 'complete' on boolean 'true' on line options.complete = callback;
|
|
| options = options || {}; | ||
| if ( typeof options === "number" ) { | ||
| options = { duration: options }; | ||
| } else if ( options === true ) { |
There was a problem hiding this comment.
When is true allowed for options? Is there a current test that fails without this? If not, could you add one?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Do you have a code example that shows the problem? It's still not clear to me how this would occur.
There was a problem hiding this comment.
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
dmethvin
left a comment
There was a problem hiding this comment.
Sorry it took a while, reading the code above these lines I agree this looks like a bug! The false case is handled elsewhere so only true trips it up.
Fix for `options === true` when using jQuery UI under `use strict`, which throws: ``` Uncaught TypeError: Cannot create property 'complete' on boolean 'true' ``` on line: ```js options.complete = callback; ``` Closes gh-1931
When using jQuery UI under use strict, options === true (default for ie tooltip show/hide) will throw
Uncaught TypeError: Cannot create property 'complete' on boolean 'true'
on line
options.complete = callback;