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

Function urlResolve

test/angular/1.4/angular.js:18368–18393  ·  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

18366 *
18367 */
18368function urlResolve(url) {
18369 var href = url;
18370
18371 if (msie) {
18372 // Normalize before parse. Refer Implementation Notes on why this is
18373 // done in two steps on IE.
18374 urlParsingNode.setAttribute("href", href);
18375 href = urlParsingNode.href;
18376 }
18377
18378 urlParsingNode.setAttribute('href', href);
18379
18380 // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
18381 return {
18382 href: urlParsingNode.href,
18383 protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
18384 host: urlParsingNode.host,
18385 search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
18386 hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
18387 hostname: urlParsingNode.hostname,
18388 port: urlParsingNode.port,
18389 pathname: (urlParsingNode.pathname.charAt(0) === '/')
18390 ? urlParsingNode.pathname
18391 : '/' + urlParsingNode.pathname
18392 };
18393}
18394
18395/**
18396 * 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