* * 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)
| 21778 | * |
| 21779 | */ |
| 21780 | function urlResolve(url) { |
| 21781 | if (!isString(url)) return url; |
| 21782 | |
| 21783 | var href = url; |
| 21784 | |
| 21785 | // Support: IE 9-11 only |
| 21786 | if (msie) { |
| 21787 | // Normalize before parse. Refer Implementation Notes on why this is |
| 21788 | // done in two steps on IE. |
| 21789 | urlParsingNode.setAttribute('href', href); |
| 21790 | href = urlParsingNode.href; |
| 21791 | } |
| 21792 | |
| 21793 | urlParsingNode.setAttribute('href', href); |
| 21794 | |
| 21795 | var hostname = urlParsingNode.hostname; |
| 21796 | |
| 21797 | if (!ipv6InBrackets && hostname.indexOf(':') > -1) { |
| 21798 | hostname = '[' + hostname + ']'; |
| 21799 | } |
| 21800 | |
| 21801 | return { |
| 21802 | href: urlParsingNode.href, |
| 21803 | protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '', |
| 21804 | host: urlParsingNode.host, |
| 21805 | search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '', |
| 21806 | hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '', |
| 21807 | hostname: hostname, |
| 21808 | port: urlParsingNode.port, |
| 21809 | pathname: (urlParsingNode.pathname.charAt(0) === '/') |
| 21810 | ? urlParsingNode.pathname |
| 21811 | : '/' + urlParsingNode.pathname |
| 21812 | }; |
| 21813 | } |
| 21814 | |
| 21815 | /** |
| 21816 | * Parse a request URL and determine whether this is a same-origin request as the application |
no test coverage detected