MCPcopy
hub / github.com/binux/qiandao / urlResolve

Function urlResolve

web/static/components/angularjs/angular.js:14342–14367  ·  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

14340 *
14341 */
14342function urlResolve(url, base) {
14343 var href = url;
14344
14345 if (msie) {
14346 // Normalize before parse. Refer Implementation Notes on why this is
14347 // done in two steps on IE.
14348 urlParsingNode.setAttribute("href", href);
14349 href = urlParsingNode.href;
14350 }
14351
14352 urlParsingNode.setAttribute('href', href);
14353
14354 // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
14355 return {
14356 href: urlParsingNode.href,
14357 protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
14358 host: urlParsingNode.host,
14359 search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
14360 hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
14361 hostname: urlParsingNode.hostname,
14362 port: urlParsingNode.port,
14363 pathname: (urlParsingNode.pathname.charAt(0) === '/')
14364 ? urlParsingNode.pathname
14365 : '/' + urlParsingNode.pathname
14366 };
14367}
14368
14369/**
14370 * 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