2015-07-16 00:30:36 +00:00
|
|
|
/*!
|
|
|
|
* jQuery UI Unique ID @VERSION
|
|
|
|
* http://jqueryui.com
|
|
|
|
*
|
2022-07-19 07:36:55 +00:00
|
|
|
* Copyright OpenJS Foundation and other contributors
|
2015-07-16 00:30:36 +00:00
|
|
|
* 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 ) {
|
2021-06-06 22:58:12 +00:00
|
|
|
"use strict";
|
|
|
|
|
2015-07-16 00:30:36 +00:00
|
|
|
if ( typeof define === "function" && define.amd ) {
|
|
|
|
|
|
|
|
// AMD. Register as an anonymous module.
|
|
|
|
define( [ "jquery", "./version" ], factory );
|
|
|
|
} else {
|
|
|
|
|
|
|
|
// Browser globals
|
|
|
|
factory( jQuery );
|
|
|
|
}
|
2021-06-06 22:58:12 +00:00
|
|
|
} )( function( $ ) {
|
|
|
|
"use strict";
|
2015-07-16 00:30:36 +00:00
|
|
|
|
|
|
|
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" );
|
|
|
|
}
|
|
|
|
} );
|
|
|
|
}
|
|
|
|
} );
|
|
|
|
|
2021-06-06 22:58:12 +00:00
|
|
|
} );
|