@doegis/core
Version:
DOE GIS API
3 lines (1 loc) • 818 B
JavaScript
function e(e){return"string"==typeof e?document.getElementById(e):e??null}function t(e){for(;e.hasChildNodes();)e.removeChild(e.firstChild)}function n(e,t){const n=t.parentNode;n&&(n.lastChild===t?n.appendChild(e):n.insertBefore(e,t.nextSibling))}function o(e,t){const n=t.parentNode;n&&n.insertBefore(e,t)}function r(e,t){for(;;){const n=e.firstChild;if(!n)break;t.appendChild(n)}}function l(e){e.parentNode&&e.parentNode.removeChild(e)}const i=(()=>{if("function"==typeof Element.prototype.closest)return(e,t)=>e.closest(t);const e=Element.prototype.matches||Element.prototype.msMatchesSelector;return(t,n)=>{let o=t;do{if(e.call(o,n))return o;o=o.parentElement}while(null!==o&&1===o.nodeType);return null}})();export{e as byId,i as closest,t as empty,n as insertAfter,o as insertBefore,l as remove,r as reparent};