public/javascripts/yui/dom/dom-debug.js
function(el, prefix) {
            prefix = prefix || 'yui-gen';

            var f = function(el) {
                if (el && el.id) { // do not override existing ID
                    YAHOO.log('generateId returning existing id ' + el.id, 'info', 'Dom');
                    return el.id;
                }

                var id = prefix + YAHOO.env._id_counter++;
                YAHOO.log('generateId generating ' + id, 'info', 'Dom');

                if (el) {
                    if (el[OWNER_DOCUMENT] && el[OWNER_DOCUMENT].getElementById(id)) { // in case one already exists
                        // use failed id plus prefix to help ensure uniqueness
                        return Y.Dom.generateId(el, id + prefix);
                    }
                    el.id = id;
                }
                
                return id;
            };

            // batch fails when no element, so just generate and return single ID
            return Y.Dom.batch(el, f, Y.Dom, true) || f.apply(Y.Dom, arguments);
        }
function(el, prefix) {
            prefix = prefix || 'yui-gen';

            var f = function(el) {
                if (el && el.id) { // do not override existing ID
                    YAHOO.log('generateId returning existing id ' + el.id, 'info', 'Dom');
                    return el.id;
                }

                var id = prefix + YAHOO.env._id_counter++;
                YAHOO.log('generateId generating ' + id, 'info', 'Dom');

                if (el) {
                    if (el[OWNER_DOCUMENT] && el[OWNER_DOCUMENT].getElementById(id)) { // in case one already exists
                        // use failed id plus prefix to help ensure uniqueness
                        return Y.Dom.generateId(el, id + prefix);
                    }
                    el.id = id;
                }
                
                return id;
            };

            // batch fails when no element, so just generate and return single ID
            return Y.Dom.batch(el, f, Y.Dom, true) || f.apply(Y.Dom, arguments);
        }
function ( el , prefix ) { prefix = prefix || 'yui-gen' ; var f = function ( el ) { if ( el && el . id ) { // do not override existing ID YAHOO . log ( 'generateId returning existing id ' + el . id , 'info' , 'Dom' ) ; return el . id ; } var id = prefix + YAHOO . env . _id_counter ++ ; YAHOO . log ( 'generateId generating ' + id , 'info' , 'Dom' ) ; if ( el ) { if ( el [ OWNER_DOCUMENT ] && el [ OWNER_DOCUMENT ] . getElementById ( id ) ) { // in case one already exists // use failed id plus prefix to help ensure uniqueness return Y . Dom . generateId ( el , id + prefix ) ; } el . id = id ; } return id ; } ; // batch fails when no element, so just generate and return single ID return Y . Dom . batch ( el , f , Y . Dom , true ) || f . apply ( Y . Dom , arguments ) ; }
Returns an ID and applies it to the element "el", if provided.
@method generateId
@param {String | HTMLElement | Array} el (optional) An optional element array of elements to add an ID to (no ID is added if one is already present).
@param {String} prefix (optional) an optional prefix to use (defaults to "yui-gen").
@return {String | Array} The generated ID, or array of generated IDs (or original ID if already present on an element)
Returns an ID and applies it to the element el if provided .