]> source.dussan.org Git - jquery-ui.git/commitdiff
Widget: Fix boolean option when under use strict
authorHrvoje Novosel <hrvoje.novosel@gmail.com>
Wed, 15 Jul 2020 14:10:20 +0000 (16:10 +0200)
committerMichał Gołębiowski-Owczarek <m.goleb@gmail.com>
Tue, 6 Oct 2020 12:54:13 +0000 (14:54 +0200)
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

ui/widget.js

index 30034f5924ee40498d93df719d48315e5a85c607..4b58712052b1175c5153eb75ebb1e859e54f130b 100644 (file)
@@ -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 ) {
+                       options = {};
                }
 
                hasOptions = !$.isEmptyObject( options );