MCPcopy Index your code
hub / github.com/Maps4HTML/MapML.js / getBase

Method getBase

src/map-link.js:914–936  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

912 return bnds;
913 }
914 getBase() {
915 let layer = this.getRootNode().host;
916 //
917 let relativeURL =
918 this.getRootNode().querySelector('map-base') &&
919 this.getRootNode() instanceof ShadowRoot
920 ? this.getRootNode().querySelector('map-base').getAttribute('href')
921 : /* local content? */ !(this.getRootNode() instanceof ShadowRoot)
922 ? /* use the baseURI algorithm which takes into account any <base> */
923 this.getRootNode().querySelector('map-base')?.getAttribute('href') ||
924 this.baseURI
925 : /* else use the resolved <map-layer src="..."> value */ new URL(
926 layer.src,
927 layer.baseURI
928 ).href;
929
930 // when remote content, use layer.src as base else use baseURI of map-link
931 let baseURL =
932 this.getRootNode() instanceof ShadowRoot
933 ? new URL(layer.src, layer.baseURI).href
934 : this.baseURI;
935 return new URL(relativeURL, baseURL).href;
936 }
937 /**
938 * Return BOTH min/max(Display)Zoom AND min/maxNativeZoom which
939 * are options that can be passed to GridLayer...

Callers 6

hrefMethod · 0.95
_createStylesheetLinkMethod · 0.95
_initTemplateVarsMethod · 0.95
MapLayer.jsFile · 0.80

Calls 1

getAttributeMethod · 0.80

Tested by

no test coverage detected