@senad-d/drawme 0.1.11 → 0.2.0

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.
package/src/dom.ts CHANGED
@@ -36,6 +36,11 @@ export function firstByTag(el: DomEl, tag: string): DomEl | null {
36
36
  return null;
37
37
  }
38
38
 
39
+ /** Uncompressed graph, supplied as a bare model or as a page's direct child. */
40
+ export function graphModel(pageOrModel: DomEl): DomEl | null {
41
+ return pageOrModel.tagName === "mxGraphModel" ? pageOrModel : firstByTag(pageOrModel, "mxGraphModel");
42
+ }
43
+
39
44
  /** Attribute value, or null when absent (distinguishes absent from empty). */
40
45
  export function attr(el: DomEl, name: string): string | null {
41
46
  return el.hasAttribute(name) ? el.getAttribute(name) : null;