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

Function urlResolve

lib/test/angular/1.8.0/angular.js:21780–21813  ·  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

21778 *
21779 */
21780function urlResolve(url) {
21781 if (!isString(url)) return url;
21782
21783 var href = url;
21784
21785 // Support: IE 9-11 only
21786 if (msie) {
21787 // Normalize before parse. Refer Implementation Notes on why this is
21788 // done in two steps on IE.
21789 urlParsingNode.setAttribute('href', href);
21790 href = urlParsingNode.href;
21791 }
21792
21793 urlParsingNode.setAttribute('href', href);
21794
21795 var hostname = urlParsingNode.hostname;
21796
21797 if (!ipv6InBrackets && hostname.indexOf(':') > -1) {
21798 hostname = '[' + hostname + ']';
21799 }
21800
21801 return {
21802 href: urlParsingNode.href,
21803 protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
21804 host: urlParsingNode.host,
21805 search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
21806 hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
21807 hostname: hostname,
21808 port: urlParsingNode.port,
21809 pathname: (urlParsingNode.pathname.charAt(0) === '/')
21810 ? urlParsingNode.pathname
21811 : '/' + urlParsingNode.pathname
21812 };
21813}
21814
21815/**
21816 * 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