* * 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)
| 20998 | * |
| 20999 | */ |
| 21000 | function urlResolve(url) { |
| 21001 | if (!isString(url)) return url; |
| 21002 | |
| 21003 | var href = url; |
| 21004 | |
| 21005 | // Support: IE 9-11 only |
| 21006 | if (msie) { |
| 21007 | // Normalize before parse. Refer Implementation Notes on why this is |
| 21008 | // done in two steps on IE. |
| 21009 | urlParsingNode.setAttribute('href', href); |
| 21010 | href = urlParsingNode.href; |
| 21011 | } |
| 21012 | |
| 21013 | urlParsingNode.setAttribute('href', href); |
| 21014 | |
| 21015 | return { |
| 21016 | href: urlParsingNode.href, |
| 21017 | protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '', |
| 21018 | host: urlParsingNode.host, |
| 21019 | search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '', |
| 21020 | hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '', |
| 21021 | hostname: urlParsingNode.hostname, |
| 21022 | port: urlParsingNode.port, |
| 21023 | pathname: (urlParsingNode.pathname.charAt(0) === '/') |
| 21024 | ? urlParsingNode.pathname |
| 21025 | : '/' + urlParsingNode.pathname |
| 21026 | }; |
| 21027 | } |
| 21028 | |
| 21029 | /** |
| 21030 | * Parse a request URL and determine whether this is a same-origin request as the application |
no test coverage detected