From: Alexander Schmitz Date: Wed, 15 Jul 2015 22:26:12 +0000 (-0400) Subject: Core: Move version and creation of the ui namespace into its own module X-Git-Tag: 1.12.0-beta.1~230 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=3d71fb83fe02a307823594f5905be9848cfa5506;p=jquery-ui.git Core: Move version and creation of the ui namespace into its own module Ref #9647 --- diff --git a/ui/accordion.js b/ui/accordion.js index a9b843cd5..5a2c128c6 100644 --- a/ui/accordion.js +++ b/ui/accordion.js @@ -23,6 +23,7 @@ define( [ "jquery", "./core", + "./version", "./widget" ], factory ); } else { diff --git a/ui/autocomplete.js b/ui/autocomplete.js index de173cc4f..1bf8c84be 100644 --- a/ui/autocomplete.js +++ b/ui/autocomplete.js @@ -25,6 +25,7 @@ "./core", "./widget", "./position", + "./version", "./menu" ], factory ); } else { diff --git a/ui/button.js b/ui/button.js index 70cc31680..34228e2da 100644 --- a/ui/button.js +++ b/ui/button.js @@ -23,6 +23,7 @@ define([ "jquery", "./core", + "./version", "./widget" ], factory ); } else { diff --git a/ui/core.js b/ui/core.js index 9ac196d38..a529f35db 100644 --- a/ui/core.js +++ b/ui/core.js @@ -18,7 +18,9 @@ if ( typeof define === "function" && define.amd ) { // AMD. Register as an anonymous module. - define( [ "jquery" ], factory ); + define( [ + "jquery", + "./version" ], factory ); } else { // Browser globals @@ -26,11 +28,7 @@ } }( function( $ ) { -// $.ui might exist from components with no dependencies, e.g., $.ui.position -$.ui = $.ui || {}; - $.extend( $.ui, { - version: "@VERSION", keyCode: { BACKSPACE: 8, diff --git a/ui/datepicker.js b/ui/datepicker.js index cf63cbb20..372d87c60 100644 --- a/ui/datepicker.js +++ b/ui/datepicker.js @@ -22,7 +22,8 @@ // AMD. Register as an anonymous module. define([ "jquery", - "./core" + "./core", + "./version" ], factory ); } else { diff --git a/ui/dialog.js b/ui/dialog.js index e58e0c8cc..11ff77c6b 100644 --- a/ui/dialog.js +++ b/ui/dialog.js @@ -28,7 +28,8 @@ "./draggable", "./mouse", "./position", - "./resizable" + "./resizable", + "./version" ], factory ); } else { diff --git a/ui/draggable.js b/ui/draggable.js index a3cd5ba7d..261be7b48 100644 --- a/ui/draggable.js +++ b/ui/draggable.js @@ -21,6 +21,7 @@ define([ "jquery", "./core", + "./version", "./mouse", "./widget" ], factory ); diff --git a/ui/droppable.js b/ui/droppable.js index 74d54d077..c6bd35004 100644 --- a/ui/droppable.js +++ b/ui/droppable.js @@ -19,7 +19,7 @@ // AMD. Register as an anonymous module. define([ "jquery", - "./core", + "./version", "./widget", "./mouse", "./draggable" diff --git a/ui/effect-blind.js b/ui/effect-blind.js index 45358d759..87382615c 100644 --- a/ui/effect-blind.js +++ b/ui/effect-blind.js @@ -19,6 +19,7 @@ // AMD. Register as an anonymous module. define( [ "jquery", + "./version", "./effect" ], factory ); } else { diff --git a/ui/effect-bounce.js b/ui/effect-bounce.js index 8a5d58e30..80206f62d 100644 --- a/ui/effect-bounce.js +++ b/ui/effect-bounce.js @@ -19,6 +19,7 @@ // AMD. Register as an anonymous module. define( [ "jquery", + "./version", "./effect" ], factory ); } else { diff --git a/ui/effect-clip.js b/ui/effect-clip.js index 4eb24eb88..c24a764c8 100644 --- a/ui/effect-clip.js +++ b/ui/effect-clip.js @@ -19,6 +19,7 @@ // AMD. Register as an anonymous module. define( [ "jquery", + "./version", "./effect" ], factory ); } else { diff --git a/ui/effect-drop.js b/ui/effect-drop.js index 3ad90caa6..fa9ab7346 100644 --- a/ui/effect-drop.js +++ b/ui/effect-drop.js @@ -19,6 +19,7 @@ // AMD. Register as an anonymous module. define( [ "jquery", + "./version", "./effect" ], factory ); } else { diff --git a/ui/effect-explode.js b/ui/effect-explode.js index 3e468675a..918ad2c3b 100644 --- a/ui/effect-explode.js +++ b/ui/effect-explode.js @@ -19,6 +19,7 @@ // AMD. Register as an anonymous module. define( [ "jquery", + "./version", "./effect" ], factory ); } else { diff --git a/ui/effect-fade.js b/ui/effect-fade.js index ecc44722a..5d0c7caa0 100644 --- a/ui/effect-fade.js +++ b/ui/effect-fade.js @@ -19,6 +19,7 @@ // AMD. Register as an anonymous module. define( [ "jquery", + "./version", "./effect" ], factory ); } else { diff --git a/ui/effect-fold.js b/ui/effect-fold.js index a61eef0ab..01aca3a61 100644 --- a/ui/effect-fold.js +++ b/ui/effect-fold.js @@ -19,6 +19,7 @@ // AMD. Register as an anonymous module. define( [ "jquery", + "./version", "./effect" ], factory ); } else { diff --git a/ui/effect-highlight.js b/ui/effect-highlight.js index 721a3a05b..ed903dc3d 100644 --- a/ui/effect-highlight.js +++ b/ui/effect-highlight.js @@ -19,6 +19,7 @@ // AMD. Register as an anonymous module. define( [ "jquery", + "./version", "./effect" ], factory ); } else { diff --git a/ui/effect-puff.js b/ui/effect-puff.js index ac3f90a64..c1640a5d7 100644 --- a/ui/effect-puff.js +++ b/ui/effect-puff.js @@ -19,6 +19,7 @@ // AMD. Register as an anonymous module. define( [ "jquery", + "./version", "./effect", "./effect-scale" ], factory ); diff --git a/ui/effect-pulsate.js b/ui/effect-pulsate.js index f6f46da76..35e6d81ee 100644 --- a/ui/effect-pulsate.js +++ b/ui/effect-pulsate.js @@ -19,6 +19,7 @@ // AMD. Register as an anonymous module. define( [ "jquery", + "./version", "./effect" ], factory ); } else { diff --git a/ui/effect-scale.js b/ui/effect-scale.js index 5d76ac166..8602aeeb4 100644 --- a/ui/effect-scale.js +++ b/ui/effect-scale.js @@ -19,6 +19,7 @@ // AMD. Register as an anonymous module. define( [ "jquery", + "./version", "./effect", "./effect-size" ], factory ); diff --git a/ui/effect-shake.js b/ui/effect-shake.js index 52240fed0..0fe27e2b6 100644 --- a/ui/effect-shake.js +++ b/ui/effect-shake.js @@ -19,6 +19,7 @@ // AMD. Register as an anonymous module. define( [ "jquery", + "./version", "./effect" ], factory ); } else { diff --git a/ui/effect-size.js b/ui/effect-size.js index 16a2adac1..0fe8f120f 100644 --- a/ui/effect-size.js +++ b/ui/effect-size.js @@ -19,6 +19,7 @@ // AMD. Register as an anonymous module. define( [ "jquery", + "./version", "./effect" ], factory ); } else { diff --git a/ui/effect-slide.js b/ui/effect-slide.js index 1f4013058..9d62f2228 100644 --- a/ui/effect-slide.js +++ b/ui/effect-slide.js @@ -19,6 +19,7 @@ // AMD. Register as an anonymous module. define( [ "jquery", + "./version", "./effect" ], factory ); } else { diff --git a/ui/effect-transfer.js b/ui/effect-transfer.js index 41208b9e6..9ac9398c0 100644 --- a/ui/effect-transfer.js +++ b/ui/effect-transfer.js @@ -19,6 +19,7 @@ // AMD. Register as an anonymous module. define( [ "jquery", + "./version", "./effect" ], factory ); } else { diff --git a/ui/effect.js b/ui/effect.js index 86afea226..7fa45cfc0 100644 --- a/ui/effect.js +++ b/ui/effect.js @@ -17,7 +17,7 @@ if ( typeof define === "function" && define.amd ) { // AMD. Register as an anonymous module. - define( [ "jquery" ], factory ); + define( [ "jquery", "./version" ], factory ); } else { // Browser globals diff --git a/ui/form-reset-mixin.js b/ui/form-reset-mixin.js index a751f7f2a..423a35538 100644 --- a/ui/form-reset-mixin.js +++ b/ui/form-reset-mixin.js @@ -4,7 +4,8 @@ // AMD. Register as an anonymous module. define( [ "jquery", - "ui/core" + "ui/core", + "./version" ], factory ); } else { diff --git a/ui/menu.js b/ui/menu.js index 89281e4f0..e39fb0bdb 100644 --- a/ui/menu.js +++ b/ui/menu.js @@ -23,6 +23,7 @@ define( [ "jquery", "./core", + "./version", "./widget", "./position" ], factory ); diff --git a/ui/mouse.js b/ui/mouse.js index f9c259552..e197fd60a 100644 --- a/ui/mouse.js +++ b/ui/mouse.js @@ -18,6 +18,7 @@ // AMD. Register as an anonymous module. define([ "jquery", + "./version", "./widget" ], factory ); } else { diff --git a/ui/position.js b/ui/position.js index 172503fef..e9e805bb6 100644 --- a/ui/position.js +++ b/ui/position.js @@ -19,7 +19,7 @@ if ( typeof define === "function" && define.amd ) { // AMD. Register as an anonymous module. - define( [ "jquery" ], factory ); + define( [ "jquery", "./version" ], factory ); } else { // Browser globals @@ -27,9 +27,6 @@ } }( function( $ ) { ( function() { - -$.ui = $.ui || {}; - var cachedScrollbarWidth, supportsOffsetFractions, max = Math.max, abs = Math.abs, diff --git a/ui/progressbar.js b/ui/progressbar.js index 4dc44d22a..7b1cc9351 100644 --- a/ui/progressbar.js +++ b/ui/progressbar.js @@ -22,7 +22,7 @@ // AMD. Register as an anonymous module. define( [ "jquery", - "./core", + "./version", "./widget" ], factory ); } else { diff --git a/ui/resizable.js b/ui/resizable.js index 6e51f4aac..6b4fd1013 100644 --- a/ui/resizable.js +++ b/ui/resizable.js @@ -23,6 +23,7 @@ define([ "jquery", "./core", + "./version", "./mouse", "./widget" ], factory ); diff --git a/ui/selectable.js b/ui/selectable.js index c1d445954..ec4895d15 100644 --- a/ui/selectable.js +++ b/ui/selectable.js @@ -20,7 +20,7 @@ // AMD. Register as an anonymous module. define([ "jquery", - "./core", + "./version", "./mouse", "./widget" ], factory ); diff --git a/ui/selectmenu.js b/ui/selectmenu.js index db2cea712..227d87ae7 100644 --- a/ui/selectmenu.js +++ b/ui/selectmenu.js @@ -23,6 +23,7 @@ define( [ "jquery", "./core", + "./version", "./widget", "./position", "./menu" diff --git a/ui/slider.js b/ui/slider.js index 830c1cbd7..db5f341b3 100644 --- a/ui/slider.js +++ b/ui/slider.js @@ -24,6 +24,7 @@ "jquery", "./core", "./mouse", + "./version", "./widget" ], factory ); } else { diff --git a/ui/sortable.js b/ui/sortable.js index bf1bf6a89..0c638906d 100644 --- a/ui/sortable.js +++ b/ui/sortable.js @@ -22,6 +22,7 @@ "jquery", "./core", "./mouse", + "./version", "./widget" ], factory ); } else { diff --git a/ui/spinner.js b/ui/spinner.js index c56d2c918..fa07c9ab1 100644 --- a/ui/spinner.js +++ b/ui/spinner.js @@ -23,6 +23,7 @@ define( [ "jquery", "./core", + "./version", "./widget", "./button" ], factory ); diff --git a/ui/tabs.js b/ui/tabs.js index f267ad4bf..5aaa8c5fa 100644 --- a/ui/tabs.js +++ b/ui/tabs.js @@ -23,6 +23,7 @@ define( [ "jquery", "./core", + "./version", "./widget" ], factory ); } else { diff --git a/ui/tooltip.js b/ui/tooltip.js index e18f3e19d..c58bc65dc 100644 --- a/ui/tooltip.js +++ b/ui/tooltip.js @@ -23,6 +23,7 @@ define( [ "jquery", "./core", + "./version", "./widget", "./position" ], factory ); diff --git a/ui/version.js b/ui/version.js new file mode 100644 index 000000000..fdd99f79f --- /dev/null +++ b/ui/version.js @@ -0,0 +1,17 @@ +( function( factory ) { + if ( typeof define === "function" && define.amd ) { + + // AMD. Register as an anonymous module. + define( [ "jquery" ], factory ); + } else { + + // Browser globals + factory( jQuery ); + } +} ( function( $ ) { + +$.ui = $.ui || {}; + +return $.ui.version = "@VERSION"; + +} ) ); diff --git a/ui/widget.js b/ui/widget.js index 603a49136..c6f228efd 100644 --- a/ui/widget.js +++ b/ui/widget.js @@ -17,7 +17,7 @@ if ( typeof define === "function" && define.amd ) { // AMD. Register as an anonymous module. - define( [ "jquery" ], factory ); + define( [ "jquery", "./version" ], factory ); } else { // Browser globals