Skip to content

Commit

Permalink
Core: Movie uniqueId into its own module and deprecate core module
Browse files Browse the repository at this point in the history
uniqueId was the last thing in the core module, and it is now just a helper
which require all the modules it used to contain.

Closes #9647
  • Loading branch information
arschmitz committed Aug 8, 2015
1 parent 72bfafb commit 37602d7
Show file tree
Hide file tree
Showing 9 changed files with 82 additions and 62 deletions.
4 changes: 2 additions & 2 deletions tests/unit/core/core.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
define( [
"jquery",
"lib/common",
"ui/core",
"ui/form",
"ui/labels"
"ui/labels",
"ui/unique-id"
], function( $, common ) {

module( "core - jQuery extensions" );
Expand Down
3 changes: 2 additions & 1 deletion ui/accordion.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@
define( [
"jquery",
"./version",
"./core",
"./version",
"./keycode",
"./unique-id",
"./widget"
], factory );
} else {
Expand Down
75 changes: 21 additions & 54 deletions ui/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,58 +12,25 @@
//>>group: UI Core
//>>description: The core of jQuery UI, required for all interactions and widgets.
//>>docs: http://api.jqueryui.com/category/ui-core/
//>>demos: http://jqueryui.com/

( function( factory ) {
if ( typeof define === "function" && define.amd ) {

// AMD. Register as an anonymous module.
define( [
"jquery",
"./data",
"./disable-selection",
"./focusable",
"./form",
"./ie",
"./keycode",
"./labels",
"./jquery-1-7",
"./plugin",
"./safe-active-element",
"./safe-blur",
"./tabbable",
"./scroll-parent",
"./version"
], factory );
} else {

// Browser globals
factory( jQuery );
}
}( function( $ ) {

// plugins
$.fn.extend( {

uniqueId: ( function() {
var uuid = 0;

return function() {
return this.each( function() {
if ( !this.id ) {
this.id = "ui-id-" + ( ++uuid );
}
} );
};
} )(),

removeUniqueId: function() {
return this.each( function() {
if ( /^ui-id-\d+$/.test( this.id ) ) {
$( this ).removeAttr( "id" );
}
} );
}
} );

} ) );
// This file is deprecated in 1.12.0 to be removed in 1.13
( function() {
define( [
"jquery",
"./data",
"./disable-selection",
"./focusable",
"./form",
"./ie",
"./keycode",
"./labels",
"./jquery-1-7",
"./plugin",
"./safe-active-element",
"./safe-blur",
"./scroll-parent",
"./tabbable",
"./unique-id",
"./version"
] );
} )();
3 changes: 2 additions & 1 deletion ui/dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
"./resizable",
"./safe-active-element",
"./safe-blur",
"./tabbable"
"./tabbable",
"./unique-id"
], factory );
} else {

Expand Down
1 change: 1 addition & 0 deletions ui/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"./keycode",
"./position",
"./safe-active-element",
"./unique-id",
"./widget"
], factory );
} else {
Expand Down
2 changes: 1 addition & 1 deletion ui/selectmenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@
// AMD. Register as an anonymous module.
define( [
"jquery",
"./core",
"./version",
"./escape-selector",
"./menu",
"./keycode",
"./labels",
"./position",
"./unique-id",
"./version",
"./widget"
], factory );
Expand Down
2 changes: 1 addition & 1 deletion ui/tabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
// AMD. Register as an anonymous module.
define( [
"jquery",
"./core",
"./escape-selector",
"./keycode",
"./safe-active-element",
"./unique-id",
"./version",
"./widget"
], factory );
Expand Down
5 changes: 3 additions & 2 deletions ui/tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,12 @@
// AMD. Register as an anonymous module.
define( [
"jquery",
"./core",
"./keycode",
"./position",
"./unique-id",
"./version",
"./widget" ], factory );
"./widget"
], factory );
} else {

// Browser globals
Expand Down
49 changes: 49 additions & 0 deletions ui/unique-id.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*!
* jQuery UI Unique ID @VERSION
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*/

//>>label: uniqueId
//>>group: Core
//>>description: Functions to generate and remove uniqueId's
//>>docs: http://api.jqueryui.com/uniqueId/

( function( factory ) {
if ( typeof define === "function" && define.amd ) {

// AMD. Register as an anonymous module.
define( [ "jquery", "./version" ], factory );
} else {

// Browser globals
factory( jQuery );
}
} ( function( $ ) {

return $.fn.extend( {
uniqueId: ( function() {
var uuid = 0;

return function() {
return this.each( function() {
if ( !this.id ) {
this.id = "ui-id-" + ( ++uuid );
}
} );
};
} )(),

removeUniqueId: function() {
return this.each( function() {
if ( /^ui-id-\d+$/.test( this.id ) ) {
$( this ).removeAttr( "id" );
}
} );
}
} );

} ) );

0 comments on commit 37602d7

Please sign in to comment.