MCPcopy Create free account
hub / github.com/cafebazaar/blacksmith / urlResolve

Function urlResolve

web/static/bower_components/angular/angular.js:17955–17980  ·  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

17953 *
17954 */
17955function urlResolve(url) {
17956 var href = url;
17957
17958 if (msie) {
17959 // Normalize before parse. Refer Implementation Notes on why this is
17960 // done in two steps on IE.
17961 urlParsingNode.setAttribute("href", href);
17962 href = urlParsingNode.href;
17963 }
17964
17965 urlParsingNode.setAttribute('href', href);
17966
17967 // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
17968 return {
17969 href: urlParsingNode.href,
17970 protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
17971 host: urlParsingNode.host,
17972 search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
17973 hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
17974 hostname: urlParsingNode.hostname,
17975 port: urlParsingNode.port,
17976 pathname: (urlParsingNode.pathname.charAt(0) === '/')
17977 ? urlParsingNode.pathname
17978 : '/' + urlParsingNode.pathname
17979 };
17980}
17981
17982/**
17983 * Parse a request URL and determine whether this is a same-origin request as the application document.

Callers 8

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

Calls

no outgoing calls

Tested by

no test coverage detected