MCPcopy
hub / github.com/ampproject/amphtml / resolveRelativeUrl

Function resolveRelativeUrl

src/url.js:544–550  ·  view source on GitHub ↗
(relativeUrlString, baseUrl)

Source from the content-addressed store, hash-verified

542 * @return {string}
543 */
544export function resolveRelativeUrl(relativeUrlString, baseUrl) {
545 baseUrl = urlAsLocation(baseUrl);
546 if (mode.isEsm() || typeof URL == 'function') {
547 return new URL(relativeUrlString, baseUrl.href).toString();
548 }
549 return resolveRelativeUrlFallback_(relativeUrlString, baseUrl);
550}
551
552/**
553 * Returns absolute URL resolved based on the relative URL and the element.

Callers 13

testRelUrlFunction · 0.90
resolveUrlAttrFunction · 0.90
resolveImageUrlAttrFunction · 0.90
getMapKey_Method · 0.90
resolveRelativeUrlMethod · 0.90
buildCallbackMethod · 0.90
validatePageFunction · 0.90
assertRecoFunction · 0.90
resolveUrlMethod · 0.90
getConsentRemote_Method · 0.90
set_Method · 0.90

Calls 3

urlAsLocationFunction · 0.85
toStringMethod · 0.45

Tested by

no test coverage detected