* * 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)
| 20039 | * |
| 20040 | */ |
| 20041 | function urlResolve(url) { |
| 20042 | var href = url; |
| 20043 | |
| 20044 | if (msie) { |
| 20045 | // Normalize before parse. Refer Implementation Notes on why this is |
| 20046 | // done in two steps on IE. |
| 20047 | urlParsingNode.setAttribute('href', href); |
| 20048 | href = urlParsingNode.href; |
| 20049 | } |
| 20050 | |
| 20051 | urlParsingNode.setAttribute('href', href); |
| 20052 | |
| 20053 | // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils |
| 20054 | return { |
| 20055 | href: urlParsingNode.href, |
| 20056 | protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '', |
| 20057 | host: urlParsingNode.host, |
| 20058 | search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '', |
| 20059 | hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '', |
| 20060 | hostname: urlParsingNode.hostname, |
| 20061 | port: urlParsingNode.port, |
| 20062 | pathname: (urlParsingNode.pathname.charAt(0) === '/') |
| 20063 | ? urlParsingNode.pathname |
| 20064 | : '/' + urlParsingNode.pathname |
| 20065 | }; |
| 20066 | } |
| 20067 | |
| 20068 | /** |
| 20069 | * Parse a request URL and determine whether this is a same-origin request as the application document. |
no outgoing calls
no test coverage detected