MCPcopy Index your code
hub / github.com/angular/angular / resolveUrl

Function resolveUrl

packages/router/upgrade/src/upgrade.ts:144–156  ·  view source on GitHub ↗
(url: string)

Source from the content-addressed store, hash-verified

142 */
143let anchor: HTMLAnchorElement | undefined;
144function resolveUrl(url: string): {pathname: string; search: string; hash: string} {
145 anchor ??= document.createElement('a');
146
147 anchor.setAttribute('href', url);
148 anchor.setAttribute('href', anchor.href);
149
150 return {
151 // IE does not start `pathname` with `/` like other browsers.
152 pathname: `/${anchor.pathname.replace(/^\//, '')}`,
153 search: anchor.search,
154 hash: anchor.hash,
155 };
156}

Callers 1

setUpLocationSyncFunction · 0.70

Calls 3

createElementMethod · 0.65
setAttributeMethod · 0.65
replaceMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…