MCPcopy
hub / github.com/angular-ui/ui-router / urlResolve

Function urlResolve

test/angular/1.5/angular.js:20041–20066  ·  view source on GitHub ↗

* * 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)

Source from the content-addressed store, hash-verified

20039 *
20040 */
20041function 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.

Callers 8

createHttpBackendFunction · 0.70
parseAbsoluteUrlFunction · 0.70
parseAppUrlFunction · 0.70
$LocationProviderFunction · 0.70
$$SanitizeUriProviderFunction · 0.70
angular.jsFile · 0.70
urlIsSameOriginFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected