Debian Codegraph @

ui/unique-id.js

raw symbols SCIP
1 /*!
2 * jQuery UI Unique ID 1.14.2
3 * https://jqueryui.com
4 *
5 * Copyright OpenJS Foundation and other contributors
6 * Released under the MIT license.
7 * https://jquery.org/license
8 */
9
10 //>>label: uniqueId
11 //>>group: Core
12 //>>description: Functions to generate and remove uniqueId's
13 //>>docs: https://api.jqueryui.com/uniqueId/
14
15 ( function( factory ) {
16 "use strict";
17
18 if ( typeof define === "function" && define.amd ) {
19
20 // AMD. Register as an anonymous module.
21 define( [ "jquery", "./version" ], factory );
22 } else {
23
24 // Browser globals
25 factory( jQuery );
26 }
27 } )( function( $ ) {
28 "use strict";
29
30 return $.fn.extend( {
31 uniqueId: ( function() {
32 var uuid = 0;
33
34 return function() {
35 return this.each( function() {
36 if ( !this.id ) {
37 this.id = "ui-id-" + ( ++uuid );
38 }
39 } );
40 };
41 } )(),
42
43 removeUniqueId: function() {
44 return this.each( function() {
45 if ( /^ui-id-\d+$/.test( this.id ) ) {
46 $( this ).removeAttr( "id" );
47 }
48 } );
49 }
50 } );
51
52 } );