* * 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)
| 20921 | * |
| 20922 | */ |
| 20923 | function urlResolve(url) { |
| 20924 | if (!isString(url)) return url; |
| 20925 | |
| 20926 | var href = url; |
| 20927 | |
| 20928 | // Support: IE 9-11 only |
| 20929 | if (msie) { |
| 20930 | // Normalize before parse. Refer Implementation Notes on why this is |
| 20931 | // done in two steps on IE. |
| 20932 | urlParsingNode.setAttribute('href', href); |
| 20933 | href = urlParsingNode.href; |
| 20934 | } |
| 20935 | |
| 20936 | urlParsingNode.setAttribute('href', href); |
| 20937 | |
| 20938 | // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils |
| 20939 | return { |
| 20940 | href: urlParsingNode.href, |
| 20941 | protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '', |
| 20942 | host: urlParsingNode.host, |
| 20943 | search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '', |
| 20944 | hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '', |
| 20945 | hostname: urlParsingNode.hostname, |
| 20946 | port: urlParsingNode.port, |
| 20947 | pathname: (urlParsingNode.pathname.charAt(0) === '/') |
| 20948 | ? urlParsingNode.pathname |
| 20949 | : '/' + urlParsingNode.pathname |
| 20950 | }; |
| 20951 | } |
| 20952 | |
| 20953 | /** |
| 20954 | * Parse a request URL and determine whether this is a same-origin request as the application |
no test coverage detected