* * Implementation Notes for non-IE browsers * ---------------------------------------- * Assigning a URL to the href property of an anchor DOM node, even one attached to the DOM, * results both in the normalizing and parsing of the URL. Normalizing means that a relative * URL will be resolved
(url)
| 21713 | * |
| 21714 | */ |
| 21715 | function urlResolve(url) { |
| 21716 | if (!isString(url)) return url; |
| 21717 | |
| 21718 | var href = url; |
| 21719 | |
| 21720 | // Support: IE 9-11 only |
| 21721 | if (msie) { |
| 21722 | // Normalize before parse. Refer Implementation Notes on why this is |
| 21723 | // done in two steps on IE. |
| 21724 | urlParsingNode.setAttribute('href', href); |
| 21725 | href = urlParsingNode.href; |
| 21726 | } |
| 21727 | |
| 21728 | urlParsingNode.setAttribute('href', href); |
| 21729 | |
| 21730 | var hostname = urlParsingNode.hostname; |
| 21731 | |
| 21732 | if (!ipv6InBrackets && hostname.indexOf(':') > -1) { |
| 21733 | hostname = '[' + hostname + ']'; |
| 21734 | } |
| 21735 | |
| 21736 | return { |
| 21737 | href: urlParsingNode.href, |
| 21738 | protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '', |
| 21739 | host: urlParsingNode.host, |
| 21740 | search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '', |
| 21741 | hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '', |
| 21742 | hostname: hostname, |
| 21743 | port: urlParsingNode.port, |
| 21744 | pathname: (urlParsingNode.pathname.charAt(0) === '/') |
| 21745 | ? urlParsingNode.pathname |
| 21746 | : '/' + urlParsingNode.pathname |
| 21747 | }; |
| 21748 | } |
| 21749 | |
| 21750 | /** |
| 21751 | * Parse a request URL and determine whether this is a same-origin request as the application |
no test coverage detected