5 lines
		
	
	
		
			2.9 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			5 lines
		
	
	
		
			2.9 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
/* interact.js 1.10.27 | https://raw.github.com/taye/interact.js/main/LICENSE */
 | 
						|
 | 
						|
import browser from"./browser.prod.js";import domObjects from"./domObjects.prod.js";import is from"./is.prod.js";import{window as win,realWindow,getWindow}from"./window.prod.js";import"./isWindow.prod.js";function nodeContains(e,t){if(e.contains)return e.contains(t);for(;t;){if(t===e)return!0;t=t.parentNode}return!1}function closest(e,t){for(;is.element(e);){if(matchesSelector(e,t))return e;e=parentNode(e)}return null}function parentNode(e){let t=e.parentNode;if(is.docFrag(t)){for(;(t=t.host)&&is.docFrag(t););return t}return t}function matchesSelector(e,t){return win!==realWindow&&(t=t.replace(/\/deep\//g," ")),e[browser.prefixedMatchesSelector](t)}const getParent=e=>e.parentNode||e.host;function indexOfDeepestElement(e){let t,n=[];for(let o=0;o<e.length;o++){const r=e[o],i=e[t];if(!r||o===t)continue;if(!i){t=o;continue}const c=getParent(r),s=getParent(i);if(c===r.ownerDocument)continue;if(s===r.ownerDocument){t=o;continue}if(c===s){zIndexIsHigherThan(r,i)&&(t=o);continue}let l;if(n=n.length?n:getNodeParents(i),i instanceof domObjects.HTMLElement&&r instanceof domObjects.SVGElement&&!(r instanceof domObjects.SVGSVGElement)){if(r===s)continue;l=r.ownerSVGElement}else l=r;const u=getNodeParents(l,i.ownerDocument);let f=0;for(;u[f]&&u[f]===n[f];)f++;const m=[u[f-1],u[f],n[f]];if(m[0]){let e=m[0].lastChild;for(;e;){if(e===m[1]){t=o,n=u;break}if(e===m[2])break;e=e.previousSibling}}}return t}function getNodeParents(e,t){const n=[];let o,r=e;for(;(o=getParent(r))&&r!==t&&o!==r.ownerDocument;)n.unshift(r),r=o;return n}function zIndexIsHigherThan(e,t){return(parseInt(getWindow(e).getComputedStyle(e).zIndex,10)||0)>=(parseInt(getWindow(t).getComputedStyle(t).zIndex,10)||0)}function matchesUpTo(e,t,n){for(;is.element(e);){if(matchesSelector(e,t))return!0;if((e=parentNode(e))===n)return matchesSelector(e,t)}return!1}function getActualElement(e){return e.correspondingUseElement||e}function getScrollXY(e){return{x:(e=e||win).scrollX||e.document.documentElement.scrollLeft,y:e.scrollY||e.document.documentElement.scrollTop}}function getElementClientRect(e){const t=e instanceof domObjects.SVGElement?e.getBoundingClientRect():e.getClientRects()[0];return t&&{left:t.left,right:t.right,top:t.top,bottom:t.bottom,width:t.width||t.right-t.left,height:t.height||t.bottom-t.top}}function getElementRect(e){const t=getElementClientRect(e);if(!browser.isIOS7&&t){const n=getScrollXY(getWindow(e));t.left+=n.x,t.right+=n.x,t.top+=n.y,t.bottom+=n.y}return t}function getPath(e){const t=[];for(;e;)t.push(e),e=parentNode(e);return t}function trySelector(e){return!!is.string(e)&&(domObjects.document.querySelector(e),!0)}export{closest,getActualElement,getElementClientRect,getElementRect,getPath,getScrollXY,indexOfDeepestElement,matchesSelector,matchesUpTo,nodeContains,parentNode,trySelector};
 | 
						|
//# sourceMappingURL=domUtils.prod.js.map
 |