mirror of
https://github.com/penpot/penpot.git
synced 2026-09-11 22:49:30 +00:00
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:
commit
5d6eb3b3d6
@ -170,8 +170,17 @@
|
|||||||
[^js node name]
|
[^js node name]
|
||||||
(let [name (str/camel name)]
|
(let [name (str/camel name)]
|
||||||
(loop [current node]
|
(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
|
current
|
||||||
|
|
||||||
|
:else
|
||||||
(recur (.-parentElement current))))))
|
(recur (.-parentElement current))))))
|
||||||
|
|
||||||
(defn get-parent-with-selector
|
(defn get-parent-with-selector
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user