Security update for Core, with self-updated composer
[yaffs-website] / web / core / misc / dialog / dialog.jquery-ui.es6.js
1 /**
2  * @file
3  * Adds default classes to buttons for styling purposes.
4  */
5
6 (function ($) {
7   $.widget('ui.dialog', $.ui.dialog, {
8     options: {
9       buttonClass: 'button',
10       buttonPrimaryClass: 'button--primary',
11     },
12     _createButtons() {
13       const opts = this.options;
14       let primaryIndex;
15       let $buttons;
16       let index;
17       const il = opts.buttons.length;
18       for (index = 0; index < il; index++) {
19         if (opts.buttons[index].primary && opts.buttons[index].primary === true) {
20           primaryIndex = index;
21           delete opts.buttons[index].primary;
22           break;
23         }
24       }
25       this._super();
26       $buttons = this.uiButtonSet.children().addClass(opts.buttonClass);
27       if (typeof primaryIndex !== 'undefined') {
28         $buttons.eq(index).addClass(opts.buttonPrimaryClass);
29       }
30     },
31   });
32 }(jQuery));