UNPKG

fabric

Version:

Object model for HTML5 canvas, and SVG-to-canvas parser. Backed by jsdom and node-canvas.

1 lines 896 B
{"version":3,"file":"doesSomeParentMatch.min.mjs","names":[],"sources":["../../../src/parser/doesSomeParentMatch.ts"],"sourcesContent":["import { selectorMatches } from './selectorMatches';\n\nexport function doesSomeParentMatch(\n element: HTMLElement | SVGElement,\n selectors: string[],\n) {\n let selector: string,\n parentMatching = true;\n while (\n element.parentElement &&\n element.parentElement.nodeType === 1 &&\n selectors.length\n ) {\n if (parentMatching) {\n selector = selectors.pop()!;\n }\n element = element.parentElement;\n parentMatching = selectorMatches(element, selector!);\n }\n return selectors.length === 0;\n}\n"],"mappings":"4DAEA,SAAgB,EACd,EACA,EAAA,CAEA,IAAI,EACF,EAAA,CAAiB,EACnB,KACE,EAAQ,eACR,EAAQ,cAAc,WAAa,GACnC,EAAU,QAEN,IACF,EAAW,EAAU,KAAA,EAEvB,EAAU,EAAQ,cAClB,EAAiB,EAAgB,EAAS,EAAA,CAE5C,OAAO,EAAU,SAAW,EAAX,OAAA,KAAA"}