Skip to content

Commit 0702446

Browse files
committed
Load draggable and resizable jquery-ui chunks for dialog widget only if needed
1 parent cdd4d4b commit 0702446

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

lib/web/jquery/ui-modules/dialog.js

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@
1212
define([
1313
'jquery',
1414
'jquery-ui-modules/button',
15-
'jquery-ui-modules/draggable',
16-
'jquery-ui-modules/position',
17-
'jquery-ui-modules/resizable'
15+
'jquery-ui-modules/position'
1816
], function ($, undefined) {
1917

2018
var sizeRelatedOptions = {
@@ -107,11 +105,22 @@ define([
107105
this._createTitlebar();
108106
this._createButtonPane();
109107

110-
if (this.options.draggable && $.fn.draggable) {
111-
this._makeDraggable();
108+
var widget = this;
109+
110+
if (this.options.draggable) {
111+
require(['jquery-ui-modules/draggable'], function () {
112+
if($.fn.draggable) {
113+
widget._makeDraggable();
114+
}
115+
});
112116
}
113-
if (this.options.resizable && $.fn.resizable) {
114-
this._makeResizable();
117+
118+
if (this.options.resizable) {
119+
require(['jquery-ui-modules/resizable'], function () {
120+
if($.fn.resizable) {
121+
widget._makeResizable();
122+
}
123+
});
115124
}
116125

117126
this._isOpen = false;

0 commit comments

Comments
 (0)