@flashist/flibs 0.0.301 → 0.0.302

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,4 +2,5 @@ import { Point } from "../../index";
2
2
  export declare class HtmlTools {
3
3
  static getDocumentSize(): Point;
4
4
  static createElementFromHTMLString(htmlString: string): ChildNode;
5
+ static checkIfElementIsParentOf(element: Node, targetParent: Node, maxIterations?: number): boolean;
5
6
  }
@@ -9,5 +9,22 @@ export class HtmlTools {
9
9
  // Change this to div.childNodes to support multiple top-level nodes.
10
10
  return div.firstChild;
11
11
  }
12
+ static checkIfElementIsParentOf(element, targetParent, maxIterations = 50) {
13
+ let result = false;
14
+ let curIteraction = 0;
15
+ let curParent = element.parentNode;
16
+ while (curParent) {
17
+ if (curParent === targetParent) {
18
+ result = true;
19
+ break;
20
+ }
21
+ curParent = curParent.parentElement;
22
+ curIteraction++;
23
+ if (curIteraction >= maxIterations) {
24
+ break;
25
+ }
26
+ }
27
+ return result;
28
+ }
12
29
  }
13
30
  //# sourceMappingURL=HtmlTools.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"HtmlTools.js","sourceRoot":"","sources":["../../../src/html/tools/HtmlTools.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,EACR,MAAM,aAAa,CAAC;AAErB,MAAM,OAAO,SAAS;IAClB,MAAM,CAAC,eAAe;QAClB,OAAO,IAAI,KAAK,CACZ,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,eAAe,CAAC,WAAW,EAAE,MAAM,CAAC,UAAU,CAAC,EACjE,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,eAAe,CAAC,YAAY,EAAE,MAAM,CAAC,WAAW,CAAC,CACtE,CAAA;IACL,CAAC;IAED,MAAM,CAAC,2BAA2B,CAAC,UAAkB;QACjD,IAAI,GAAG,GAAgB,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QACrD,GAAG,CAAC,SAAS,GAAG,UAAU,CAAC,IAAI,EAAE,CAAC;QAElC,qEAAqE;QACrE,OAAO,GAAG,CAAC,UAAU,CAAC;IAC1B,CAAC;CACJ"}
1
+ {"version":3,"file":"HtmlTools.js","sourceRoot":"","sources":["../../../src/html/tools/HtmlTools.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,EACR,MAAM,aAAa,CAAC;AAErB,MAAM,OAAO,SAAS;IAClB,MAAM,CAAC,eAAe;QAClB,OAAO,IAAI,KAAK,CACZ,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,eAAe,CAAC,WAAW,EAAE,MAAM,CAAC,UAAU,CAAC,EACjE,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,eAAe,CAAC,YAAY,EAAE,MAAM,CAAC,WAAW,CAAC,CACtE,CAAA;IACL,CAAC;IAED,MAAM,CAAC,2BAA2B,CAAC,UAAkB;QACjD,IAAI,GAAG,GAAgB,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QACrD,GAAG,CAAC,SAAS,GAAG,UAAU,CAAC,IAAI,EAAE,CAAC;QAElC,qEAAqE;QACrE,OAAO,GAAG,CAAC,UAAU,CAAC;IAC1B,CAAC;IAED,MAAM,CAAC,wBAAwB,CAAC,OAAa,EAAE,YAAkB,EAAE,gBAAwB,EAAE;QACzF,IAAI,MAAM,GAAY,KAAK,CAAC;QAE5B,IAAI,aAAa,GAAW,CAAC,CAAC;QAC9B,IAAI,SAAS,GAAS,OAAO,CAAC,UAAU,CAAC;QACzC,OAAO,SAAS,EAAE;YACd,IAAI,SAAS,KAAK,YAAY,EAAE;gBAC5B,MAAM,GAAG,IAAI,CAAC;gBACd,MAAM;aACT;YAED,SAAS,GAAG,SAAS,CAAC,aAAa,CAAC;YAEpC,aAAa,EAAE,CAAC;YAChB,IAAI,aAAa,IAAI,aAAa,EAAE;gBAChC,MAAM;aACT;SACJ;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flashist/flibs",
3
- "version": "0.0.301",
3
+ "version": "0.0.302",
4
4
  "scripts": {},
5
5
  "license": "MIT",
6
6
  "private": false,