Skip to content

Commit 7676946

Browse files
committed
1.12 Upgrade Guide: Document widget mixins
1 parent 5c89bf5 commit 7676946

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

page/upgrade-guide/1.12.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,27 @@ $( "#dialog" ).dialog( {
473473

474474
This will add the `ui-corner-top` and `awesome-fade-class` classes to the element which has the `ui-dialog` class, while also removing the default `ui-corner-all` class from the element which has the `ui-dialog-titlebar` class.
475475

476+
### Added support for widget mixins
477+
478+
[(#12601)](http://bugs.jqueryui.com/ticket/12601) The widget factory now supports mixins so that you can have common behaviors shared across many widgets in scenarios where inheritance doesn't make sense. Until now, this required manually extending the widget prototype with the mixins. Under the hood, this is all that's happening, but there's now dedicated syntax to make calls to the widget factory a little cleaner.
479+
480+
Old:
481+
```js
482+
$.widget( "demo.widget", $.extend( {
483+
484+
// Widget prototype
485+
}, someMixin, someOtherMixin ) );
486+
```
487+
488+
New:
489+
$.widget( "demo.widget", [ someMixin, someOtherMixin ], {
490+
491+
// Widget prototype
492+
} );
493+
```
494+
495+
As you can see, the new syntax makes it more obvious that mixins are being used because they're at the top of the call, rather than at the bottom.
496+
476497
## Effects
477498
478499
### Converted transfer effect to a jQuery plugin method

0 commit comments

Comments
 (0)