* * 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)
| 20644 | * |
| 20645 | */ |
| 20646 | function urlResolve(url) { |
| 20647 | var href = url; |
| 20648 | |
| 20649 | // Support: IE 9-11 only |
| 20650 | if (msie) { |
| 20651 | // Normalize before parse. Refer Implementation Notes on why this is |
| 20652 | // done in two steps on IE. |
| 20653 | urlParsingNode.setAttribute('href', href); |
| 20654 | href = urlParsingNode.href; |
| 20655 | } |
| 20656 | |
| 20657 | urlParsingNode.setAttribute('href', href); |
| 20658 | |
| 20659 | // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils |
| 20660 | return { |
| 20661 | href: urlParsingNode.href, |
| 20662 | protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '', |
| 20663 | host: urlParsingNode.host, |
| 20664 | search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '', |
| 20665 | hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '', |
| 20666 | hostname: urlParsingNode.hostname, |
| 20667 | port: urlParsingNode.port, |
| 20668 | pathname: (urlParsingNode.pathname.charAt(0) === '/') |
| 20669 | ? urlParsingNode.pathname |
| 20670 | : '/' + urlParsingNode.pathname |
| 20671 | }; |
| 20672 | } |
| 20673 | |
| 20674 | /** |
| 20675 | * Parse a request URL and determine whether this is a same-origin request as the application document. |
no outgoing calls
no test coverage detected