lib/kissy/5.0.0-alpha.3/build/url-debug.js
function (str, parseQueryString) {
                var m = str.match(URI_SPLIT_REG) || [], ret = {};    // old ie 7:  return "" for unmatched regexp ...
                // old ie 7:  return "" for unmatched regexp ...
                for (var part in REG_INFO) {
                    ret[part] = m[REG_INFO[part]];
                }
                if (ret.protocol) {
                    ret.protocol = ret.protocol.toLowerCase();
                }
                if (ret.hostname) {
                    ret.hostname = ret.hostname.toLowerCase();
                }
                var protocol = ret.protocol;
                if (protocol) {
                    ret.slashes = str.lastIndexOf(protocol + '//') !== -1;
                }    // mailto: yiminghe@gmail.com
                // mailto: yiminghe@gmail.com
                if (protocol && !needDoubleSlash(protocol.slice(0, -1))) {
                    if (!ret.slashes) {
                        str = str.slice(0, protocol.length) + '//' + str.slice(protocol.length);
                        ret = url.parse(str, parseQueryString);
                        ret.slashes = null;
                        return ret;
                    }
                } else {
                    // http://www.g.cn
                    // pathname => /
                    if (ret.hostname && !ret.pathname) {
                        ret.pathname = '/';
                    }
                }
                ret.path = ret.pathname;
                if (ret.search) {
                    ret.path += ret.search;
                }
                ret.host = ret.hostname;
                if (ret.port) {
                    ret.host = ret.hostname + ':' + ret.port;
                }
                if (ret.search) {
                    ret.query = ret.search.substring(1);
                }
                if (parseQueryString && ret.query) {
                    ret.query = querystring.parse(ret.query);
                }
                ret.href = url.format(ret);
                return ret;
            }
function (str, parseQueryString) {
                var m = str.match(URI_SPLIT_REG) || [], ret = {};    // old ie 7:  return "" for unmatched regexp ...
                // old ie 7:  return "" for unmatched regexp ...
                for (var part in REG_INFO) {
                    ret[part] = m[REG_INFO[part]];
                }
                if (ret.protocol) {
                    ret.protocol = ret.protocol.toLowerCase();
                }
                if (ret.hostname) {
                    ret.hostname = ret.hostname.toLowerCase();
                }
                var protocol = ret.protocol;
                if (protocol) {
                    ret.slashes = str.lastIndexOf(protocol + '//') !== -1;
                }    // mailto: yiminghe@gmail.com
                // mailto: yiminghe@gmail.com
                if (protocol && !needDoubleSlash(protocol.slice(0, -1))) {
                    if (!ret.slashes) {
                        str = str.slice(0, protocol.length) + '//' + str.slice(protocol.length);
                        ret = url.parse(str, parseQueryString);
                        ret.slashes = null;
                        return ret;
                    }
                } else {
                    // http://www.g.cn
                    // pathname => /
                    if (ret.hostname && !ret.pathname) {
                        ret.pathname = '/';
                    }
                }
                ret.path = ret.pathname;
                if (ret.search) {
                    ret.path += ret.search;
                }
                ret.host = ret.hostname;
                if (ret.port) {
                    ret.host = ret.hostname + ':' + ret.port;
                }
                if (ret.search) {
                    ret.query = ret.search.substring(1);
                }
                if (parseQueryString && ret.query) {
                    ret.query = querystring.parse(ret.query);
                }
                ret.href = url.format(ret);
                return ret;
            }
function ( str , parseQueryString ) { var m = str . match ( URI_SPLIT_REG ) || [ ] , ret = { } ; // old ie 7:  return "" for unmatched regexp ... // old ie 7:  return "" for unmatched regexp ... for ( var part in REG_INFO ) { ret [ part ] = m [ REG_INFO [ part ] ] ; } if ( ret . protocol ) { ret . protocol = ret . protocol . toLowerCase ( ) ; } if ( ret . hostname ) { ret . hostname = ret . hostname . toLowerCase ( ) ; } var protocol = ret . protocol ; if ( protocol ) { ret . slashes = str . lastIndexOf ( protocol + '//' ) !== - 1 ; } // mailto: yiminghe@gmail.com // mailto: yiminghe@gmail.com if ( protocol && ! needDoubleSlash ( protocol . slice ( 0 , - 1 ) ) ) { if ( ! ret . slashes ) { str = str . slice ( 0 , protocol . length ) + '//' + str . slice ( protocol . length ) ; ret = url . parse ( str , parseQueryString ) ; ret . slashes = null ; return ret ; } } else { // http://www.g.cn // pathname => / if ( ret . hostname && ! ret . pathname ) { ret . pathname = '/' ; } } ret . path = ret . pathname ; if ( ret . search ) { ret . path += ret . search ; } ret . host = ret . hostname ; if ( ret . port ) { ret . host = ret . hostname + ':' + ret . port ; } if ( ret . search ) { ret . query = ret . search . substring ( 1 ) ; } if ( parseQueryString && ret . query ) { ret . query = querystring . parse ( ret . query ) ; } ret . href = url . format ( ret ) ; return ret ; }
parse a url to a structured object
@param {String} str url string
@param {Boolean} [parseQueryString] whether parse query string to structured object
@return {Object}
parse a url to a structured object