public/javascripts/yui/cookie/cookie.js
function(name /*:String*/, subName /*:String*/, options /*:Object*/) /*:String*/ {
        
        var lang = YAHOO.lang;
        
        options = options || {};
        
        //check cookie name
        if (!lang.isString(name) || name === ""){
            throw new TypeError("Cookie.removeSub(): Cookie name must be a non-empty string.");
        }
        
        //check subcookie name
        if (!lang.isString(subName) || subName === ""){
            throw new TypeError("Cookie.removeSub(): Subcookie name must be a non-empty string.");
        }
        
        //get all subcookies for this cookie
        var subs = this.getSubs(name);
        
        //delete the indicated subcookie
        if (lang.isObject(subs) && lang.hasOwnProperty(subs, subName)){
            delete subs[subName];

            if (!options.removeIfEmpty) {
                //reset the cookie

                return this.setSubs(name, subs, options);
            } else {
                //reset the cookie if there are subcookies left, else remove
                for (var key in subs){
                    if (lang.hasOwnProperty(subs, key) && !lang.isFunction(subs[key]) && !lang.isUndefined(subs[key])){
                        return this.setSubs(name, subs, options);
                    }
                }
                
                return this.remove(name, options);
            }
        } else {
            return "";
        }
        
    }
function(name /*:String*/, subName /*:String*/, options /*:Object*/) /*:String*/ {
        
        var lang = YAHOO.lang;
        
        options = options || {};
        
        //check cookie name
        if (!lang.isString(name) || name === ""){
            throw new TypeError("Cookie.removeSub(): Cookie name must be a non-empty string.");
        }
        
        //check subcookie name
        if (!lang.isString(subName) || subName === ""){
            throw new TypeError("Cookie.removeSub(): Subcookie name must be a non-empty string.");
        }
        
        //get all subcookies for this cookie
        var subs = this.getSubs(name);
        
        //delete the indicated subcookie
        if (lang.isObject(subs) && lang.hasOwnProperty(subs, subName)){
            delete subs[subName];

            if (!options.removeIfEmpty) {
                //reset the cookie

                return this.setSubs(name, subs, options);
            } else {
                //reset the cookie if there are subcookies left, else remove
                for (var key in subs){
                    if (lang.hasOwnProperty(subs, key) && !lang.isFunction(subs[key]) && !lang.isUndefined(subs[key])){
                        return this.setSubs(name, subs, options);
                    }
                }
                
                return this.remove(name, options);
            }
        } else {
            return "";
        }
        
    }
function ( name /*:String*/ , subName /*:String*/ , options /*:Object*/ ) /*:String*/ { var lang = YAHOO . lang ; options = options || { } ; //check cookie name if ( ! lang . isString ( name ) || name === "" ) { throw new TypeError ( "Cookie.removeSub(): Cookie name must be a non-empty string." ) ; } //check subcookie name if ( ! lang . isString ( subName ) || subName === "" ) { throw new TypeError ( "Cookie.removeSub(): Subcookie name must be a non-empty string." ) ; } //get all subcookies for this cookie var subs = this . getSubs ( name ) ; //delete the indicated subcookie if ( lang . isObject ( subs ) && lang . hasOwnProperty ( subs , subName ) ) { delete subs [ subName ] ; if ( ! options . removeIfEmpty ) { //reset the cookie return this . setSubs ( name , subs , options ) ; } else { //reset the cookie if there are subcookies left, else remove for ( var key in subs ) { if ( lang . hasOwnProperty ( subs , key ) && ! lang . isFunction ( subs [ key ] ) && ! lang . isUndefined ( subs [ key ] ) ) { return this . setSubs ( name , subs , options ) ; } } return this . remove ( name , options ) ; } } else { return "" ; } }
Removes a subcookie with a given name. Removing the last subcookie
won't remove the entire cookie unless options.removeIfEmpty is true.
@param {String} name The name of the cookie in which the subcookie exists.
@param {String} subName The name of the subcookie to remove.
@param {Object} options (Optional) An object containing one or more
cookie options: path (a string), domain (a string), expires (a Date object),
removeIfEmpty (true/false), and secure (true/false). This must be the same
settings as the original subcookie.
@return {String} The created cookie string.
@method removeSub
@static
Removes a subcookie with a given name . Removing the last subcookie won t remove the entire cookie unless options . removeIfEmpty is true .