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

Function urlResolve

test/angular/1.7/angular.js:21715–21748  ·  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

21713 *
21714 */
21715function urlResolve(url) {
21716 if (!isString(url)) return url;
21717
21718 var href = url;
21719
21720 // Support: IE 9-11 only
21721 if (msie) {
21722 // Normalize before parse. Refer Implementation Notes on why this is
21723 // done in two steps on IE.
21724 urlParsingNode.setAttribute('href', href);
21725 href = urlParsingNode.href;
21726 }
21727
21728 urlParsingNode.setAttribute('href', href);
21729
21730 var hostname = urlParsingNode.hostname;
21731
21732 if (!ipv6InBrackets && hostname.indexOf(':') > -1) {
21733 hostname = '[' + hostname + ']';
21734 }
21735
21736 return {
21737 href: urlParsingNode.href,
21738 protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
21739 host: urlParsingNode.host,
21740 search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
21741 hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
21742 hostname: hostname,
21743 port: urlParsingNode.port,
21744 pathname: (urlParsingNode.pathname.charAt(0) === '/')
21745 ? urlParsingNode.pathname
21746 : '/' + urlParsingNode.pathname
21747 };
21748}
21749
21750/**
21751 * Parse a request URL and determine whether this is a same-origin request as the application

Callers 11

BrowserFunction · 0.70
createHttpBackendFunction · 0.70
parseAbsoluteUrlFunction · 0.70
parseAppUrlFunction · 0.70
urlsEqualFunction · 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