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

Function urlResolve

test/angular/1.2/angular.js:14592–14617  ·  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, base)

Source from the content-addressed store, hash-verified

14590 *
14591 */
14592function urlResolve(url, base) {
14593 var href = url;
14594
14595 if (msie) {
14596 // Normalize before parse. Refer Implementation Notes on why this is
14597 // done in two steps on IE.
14598 urlParsingNode.setAttribute("href", href);
14599 href = urlParsingNode.href;
14600 }
14601
14602 urlParsingNode.setAttribute('href', href);
14603
14604 // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
14605 return {
14606 href: urlParsingNode.href,
14607 protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
14608 host: urlParsingNode.host,
14609 search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
14610 hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
14611 hostname: urlParsingNode.hostname,
14612 port: urlParsingNode.port,
14613 pathname: (urlParsingNode.pathname.charAt(0) === '/')
14614 ? urlParsingNode.pathname
14615 : '/' + urlParsingNode.pathname
14616 };
14617}
14618
14619/**
14620 * Parse a request URL and determine whether this is a same-origin request as the application document.

Callers 8

completeRequestFunction · 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