Merge pull request #8739 from penpot/niwinz-main-bugfix-5

🐛 Fix error when get-parent-with-data encounters non-Element nodes
This commit is contained in:
Alejandro Alonso
2026-03-24 12:50:48 +01:00
committed by GitHub

View File

@@ -170,8 +170,17 @@
[^js node name]
(let [name (str/camel name)]
(loop [current node]
(if (or (nil? current) (obj/in? (.-dataset current) name))
(cond
(nil? current)
nil
(not= (.-nodeType current) js/Node.ELEMENT_NODE)
(recur (.-parentElement current))
(obj/in? (.-dataset current) name)
current
:else
(recur (.-parentElement current))))))
(defn get-parent-with-selector