* Returns a Location-like object for the given URL. If it is relative, * the URL gets resolved. * Consider the returned object immutable. This is enforced during * testing by freezing the object. * @param {string} url * @return {!LocationDef}
(url)
| 5303 | * @return {!LocationDef} |
| 5304 | */ |
| 5305 | function parseUrl(url) { |
| 5306 | if (!a) { |
| 5307 | a = /** @type {!HTMLAnchorElement} */ (self.document.createElement('a')); |
| 5308 | cache = self.UrlCache || (self.UrlCache = Object.create(null)); |
| 5309 | } |
| 5310 | |
| 5311 | const fromCache = cache[url]; |
| 5312 | if (fromCache) { |
| 5313 | return fromCache; |
| 5314 | } |
| 5315 | |
| 5316 | const info = parseUrlWithA(a, url); |
| 5317 | |
| 5318 | return (cache[url] = info); |
| 5319 | } |
| 5320 | |
| 5321 | /** |
| 5322 | * Returns a Location-like object for the given URL. If it is relative, |