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

Function urlResolve

test/angular/1.6/angular.js:20923–20951  ·  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

20921 *
20922 */
20923function 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

Callers 9

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

Calls 1

isStringFunction · 0.70

Tested by

no test coverage detected