mirror of
https://github.com/penpot/penpot.git
synced 2026-03-29 07:40:35 +02:00
The get-parent-with-data function traverses the DOM using parentElement to find an ancestor with a specific data-* attribute. When the current node is a non-Element DOM node (e.g. Document node reached from event handlers on window), accessing .-dataset returns undefined, causing obj/in? to throw "right-hand side of 'in' should be an object". This adds a nodeType check to skip non-Element nodes during traversal and continue up the parent chain. Signed-off-by: Andrey Antukh <niwi@niwi.nz>