Skip to content

Commit a7a89a7

Browse files
committed
Wrap source files with UMD return exports
Fixes #9464 Ref #1029
1 parent c49b9f2 commit a7a89a7

38 files changed

+609
-99
lines changed

ui/.jshintrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"jquery": true,
1919

2020
"globals": {
21+
"define": false,
2122
"Globalize": false
2223
}
2324
}

ui/jquery.ui.accordion.js

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,23 @@
1212
* jquery.ui.core.js
1313
* jquery.ui.widget.js
1414
*/
15-
(function( $, undefined ) {
15+
(function( factory ) {
16+
if ( typeof define === "function" && define.amd ) {
17+
18+
// AMD. Register as an anonymous module.
19+
define([
20+
"jquery",
21+
"./jquery.ui.core",
22+
"./jquery.ui.widget"
23+
], factory );
24+
} else {
25+
26+
// Browser globals
27+
factory( jQuery );
28+
}
29+
}(function( $ ) {
1630

17-
$.widget( "ui.accordion", {
31+
return $.widget( "ui.accordion", {
1832
version: "@VERSION",
1933
options: {
2034
active: 0,
@@ -562,4 +576,4 @@ $.widget( "ui.accordion", {
562576
}
563577
});
564578

565-
})( jQuery );
579+
}));

ui/jquery.ui.autocomplete.js

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,23 @@
1414
* jquery.ui.position.js
1515
* jquery.ui.menu.js
1616
*/
17-
(function( $, undefined ) {
17+
(function( factory ) {
18+
if ( typeof define === "function" && define.amd ) {
19+
20+
// AMD. Register as an anonymous module.
21+
define([
22+
"jquery",
23+
"./jquery.ui.core",
24+
"./jquery.ui.widget",
25+
"./jquery.ui.position",
26+
"./jquery.ui.menu"
27+
], factory );
28+
} else {
29+
30+
// Browser globals
31+
factory( jQuery );
32+
}
33+
}(function( $ ) {
1834

1935
$.widget( "ui.autocomplete", {
2036
version: "@VERSION",
@@ -602,4 +618,6 @@ $.widget( "ui.autocomplete", $.ui.autocomplete, {
602618
}
603619
});
604620

605-
}( jQuery ));
621+
return $.ui.autocomplete;
622+
623+
}));

ui/jquery.ui.button.js

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,21 @@
1212
* jquery.ui.core.js
1313
* jquery.ui.widget.js
1414
*/
15-
(function( $, undefined ) {
15+
(function( factory ) {
16+
if ( typeof define === "function" && define.amd ) {
17+
18+
// AMD. Register as an anonymous module.
19+
define([
20+
"jquery",
21+
"./jquery.ui.core",
22+
"./jquery.ui.widget"
23+
], factory );
24+
} else {
25+
26+
// Browser globals
27+
factory( jQuery );
28+
}
29+
}(function( $ ) {
1630

1731
var lastActive,
1832
baseClasses = "ui-button ui-widget ui-state-default ui-corner-all",
@@ -390,4 +404,6 @@ $.widget( "ui.buttonset", {
390404
}
391405
});
392406

393-
}( jQuery ) );
407+
return $.ui.button;
408+
409+
}));

ui/jquery.ui.core.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,17 @@
88
*
99
* http://api.jqueryui.com/category/ui-core/
1010
*/
11-
(function( $, undefined ) {
11+
(function( factory ) {
12+
if ( typeof define === "function" && define.amd ) {
13+
14+
// AMD. Register as an anonymous module.
15+
define( [ "jquery" ], factory );
16+
} else {
17+
18+
// Browser globals
19+
factory( jQuery );
20+
}
21+
}(function( $ ) {
1222

1323
// $.ui might exist from components with no dependencies, e.g., $.ui.position
1424
$.ui = $.ui || {};
@@ -286,4 +296,4 @@ $.ui.plugin = {
286296
}
287297
};
288298

289-
})( jQuery );
299+
}));

ui/jquery.ui.datepicker.js

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,20 @@
1111
* Depends:
1212
* jquery.ui.core.js
1313
*/
14-
(function( $, undefined ) {
14+
(function( factory ) {
15+
if ( typeof define === "function" && define.amd ) {
16+
17+
// AMD. Register as an anonymous module.
18+
define([
19+
"jquery",
20+
"./jquery.ui.core"
21+
], factory );
22+
} else {
23+
24+
// Browser globals
25+
factory( jQuery );
26+
}
27+
}(function( $ ) {
1528

1629
$.extend($.ui, { datepicker: { version: "@VERSION" } });
1730

@@ -2056,4 +2069,6 @@ $.datepicker.initialized = false;
20562069
$.datepicker.uuid = new Date().getTime();
20572070
$.datepicker.version = "@VERSION";
20582071

2059-
})(jQuery);
2072+
return $.datepicker;
2073+
2074+
}));

ui/jquery.ui.dialog.js

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,28 @@
1717
* jquery.ui.position.js
1818
* jquery.ui.resizable.js
1919
*/
20-
(function( $, undefined ) {
20+
(function( factory ) {
21+
if ( typeof define === "function" && define.amd ) {
22+
23+
// AMD. Register as an anonymous module.
24+
define([
25+
"jquery",
26+
"./jquery.ui.core",
27+
"./jquery.ui.widget",
28+
"./jquery.ui.button",
29+
"./jquery.ui.draggable",
30+
"./jquery.ui.mouse",
31+
"./jquery.ui.position",
32+
"./jquery.ui.resizable"
33+
], factory );
34+
} else {
35+
36+
// Browser globals
37+
factory( jQuery );
38+
}
39+
}(function( $ ) {
2140

22-
$.widget( "ui.dialog", {
41+
return $.widget( "ui.dialog", {
2342
version: "@VERSION",
2443
options: {
2544
appendTo: "body",
@@ -841,4 +860,4 @@ $.widget( "ui.dialog", {
841860
}
842861
});
843862

844-
}( jQuery ));
863+
}));

ui/jquery.ui.draggable.js

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,22 @@
1313
* jquery.ui.mouse.js
1414
* jquery.ui.widget.js
1515
*/
16-
(function( $, undefined ) {
16+
(function( factory ) {
17+
if ( typeof define === "function" && define.amd ) {
18+
19+
// AMD. Register as an anonymous module.
20+
define([
21+
"jquery",
22+
"./jquery.ui.core",
23+
"./jquery.ui.mouse",
24+
"./jquery.ui.widget"
25+
], factory );
26+
} else {
27+
28+
// Browser globals
29+
factory( jQuery );
30+
}
31+
}(function( $ ) {
1732

1833
$.widget("ui.draggable", $.ui.mouse, {
1934
version: "@VERSION",
@@ -1004,4 +1019,6 @@ $.ui.plugin.add("draggable", "zIndex", {
10041019
}
10051020
});
10061021

1007-
})(jQuery);
1022+
return $.ui.draggable;
1023+
1024+
}));

ui/jquery.ui.droppable.js

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,23 @@
1414
* jquery.ui.mouse.js
1515
* jquery.ui.draggable.js
1616
*/
17-
(function( $, undefined ) {
17+
(function( factory ) {
18+
if ( typeof define === "function" && define.amd ) {
19+
20+
// AMD. Register as an anonymous module.
21+
define([
22+
"jquery",
23+
"./jquery.ui.core",
24+
"./jquery.ui.widget",
25+
"./jquery.ui.mouse",
26+
"./jquery.ui.draggable"
27+
], factory );
28+
} else {
29+
30+
// Browser globals
31+
factory( jQuery );
32+
}
33+
}(function( $ ) {
1834

1935
$.widget( "ui.droppable", {
2036
version: "@VERSION",
@@ -401,4 +417,6 @@ $.ui.ddmanager = {
401417
}
402418
};
403419

404-
})( jQuery );
420+
return $.ui.droppable;
421+
422+
}));

ui/jquery.ui.effect-blind.js

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,22 @@
1111
* Depends:
1212
* jquery.ui.effect.js
1313
*/
14-
(function( $, undefined ) {
14+
(function( factory ) {
15+
if ( typeof define === "function" && define.amd ) {
1516

16-
$.effects.effect.blind = function( o, done ) {
17+
// AMD. Register as an anonymous module.
18+
define([
19+
"jquery",
20+
"./jquery.ui.effect"
21+
], factory );
22+
} else {
23+
24+
// Browser globals
25+
factory( jQuery );
26+
}
27+
}(function( $ ) {
28+
29+
return $.effects.effect.blind = function( o, done ) {
1730
// Create element
1831
var el = $( this ),
1932
rvertical = /up|down|vertical/,
@@ -77,4 +90,4 @@ $.effects.effect.blind = function( o, done ) {
7790
});
7891
};
7992

80-
})(jQuery);
93+
}));

ui/jquery.ui.effect-bounce.js

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,22 @@
1111
* Depends:
1212
* jquery.ui.effect.js
1313
*/
14-
(function( $, undefined ) {
14+
(function( factory ) {
15+
if ( typeof define === "function" && define.amd ) {
16+
17+
// AMD. Register as an anonymous module.
18+
define([
19+
"jquery",
20+
"./jquery.ui.effect"
21+
], factory );
22+
} else {
23+
24+
// Browser globals
25+
factory( jQuery );
26+
}
27+
}(function( $ ) {
1528

16-
$.effects.effect.bounce = function( o, done ) {
29+
return $.effects.effect.bounce = function( o, done ) {
1730
var el = $( this ),
1831
props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
1932

@@ -110,4 +123,4 @@ $.effects.effect.bounce = function( o, done ) {
110123

111124
};
112125

113-
})(jQuery);
126+
}));

ui/jquery.ui.effect-clip.js

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,22 @@
1111
* Depends:
1212
* jquery.ui.effect.js
1313
*/
14-
(function( $, undefined ) {
14+
(function( factory ) {
15+
if ( typeof define === "function" && define.amd ) {
1516

16-
$.effects.effect.clip = function( o, done ) {
17+
// AMD. Register as an anonymous module.
18+
define([
19+
"jquery",
20+
"./jquery.ui.effect"
21+
], factory );
22+
} else {
23+
24+
// Browser globals
25+
factory( jQuery );
26+
}
27+
}(function( $ ) {
28+
29+
return $.effects.effect.clip = function( o, done ) {
1730
// Create element
1831
var el = $( this ),
1932
props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
@@ -64,4 +77,4 @@ $.effects.effect.clip = function( o, done ) {
6477

6578
};
6679

67-
})(jQuery);
80+
}));

ui/jquery.ui.effect-drop.js

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,22 @@
1111
* Depends:
1212
* jquery.ui.effect.js
1313
*/
14-
(function( $, undefined ) {
14+
(function( factory ) {
15+
if ( typeof define === "function" && define.amd ) {
1516

16-
$.effects.effect.drop = function( o, done ) {
17+
// AMD. Register as an anonymous module.
18+
define([
19+
"jquery",
20+
"./jquery.ui.effect"
21+
], factory );
22+
} else {
23+
24+
// Browser globals
25+
factory( jQuery );
26+
}
27+
}(function( $ ) {
28+
29+
return $.effects.effect.drop = function( o, done ) {
1730

1831
var el = $( this ),
1932
props = [ "position", "top", "bottom", "left", "right", "opacity", "height", "width" ],
@@ -62,4 +75,4 @@ $.effects.effect.drop = function( o, done ) {
6275
});
6376
};
6477

65-
})(jQuery);
78+
}));

0 commit comments

Comments
 (0)