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

Method getOuterHTML

src/layer.js:794–834  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

792 }
793 }
794 getOuterHTML() {
795 let tempElement = this.cloneNode(true);
796
797 if (this.hasAttribute('src')) {
798 let newSrc = this._layer.getHref();
799 tempElement.setAttribute('src', newSrc);
800 }
801 if (this.querySelector('map-link')) {
802 let mapLinks = tempElement.querySelectorAll('map-link');
803
804 mapLinks.forEach((mapLink) => {
805 if (mapLink.hasAttribute('href')) {
806 mapLink.setAttribute(
807 'href',
808 decodeURI(
809 new URL(
810 mapLink.attributes.href.value,
811 this.baseURI ? this.baseURI : document.baseURI
812 ).href
813 )
814 );
815 } else if (mapLink.hasAttribute('tref')) {
816 mapLink.setAttribute(
817 'tref',
818 decodeURI(
819 new URL(
820 mapLink.attributes.tref.value,
821 this.baseURI ? this.baseURI : document.baseURI
822 ).href
823 )
824 );
825 }
826 });
827 }
828
829 let outerLayer = tempElement.outerHTML;
830
831 tempElement.remove();
832
833 return outerLayer;
834 }
835
836 zoomTo() {
837 this.whenReady().then(() => {

Callers 1

ContextMenu.jsFile · 0.45

Calls 3

setAttributeMethod · 0.80
forEachMethod · 0.80
removeMethod · 0.80

Tested by

no test coverage detected