mirror of
https://github.com/penpot/penpot.git
synced 2025-07-22 10:07:14 +02:00
📎 Add rationale comment on dom/get-data helper
This commit is contained in:
parent
4248931dff
commit
f5296cafb1
1 changed files with 7 additions and 2 deletions
|
@ -570,11 +570,16 @@
|
|||
(when (some? node)
|
||||
(= (get-active) node)))
|
||||
|
||||
(defn get-data [^js node ^string attr]
|
||||
(defn get-data
|
||||
[^js node ^string attr]
|
||||
;; NOTE: we use getAttribute instead of .dataset for performance
|
||||
;; reasons. The getAttribute is x2 faster than dataset. See more on:
|
||||
;; https://www.measurethat.net/Benchmarks/Show/14432/0/getattribute-vs-dataset
|
||||
(when (some? node)
|
||||
(.getAttribute node (dm/str "data-" attr))))
|
||||
|
||||
(defn set-data! [^js node ^string attr value]
|
||||
(defn set-data!
|
||||
[^js node ^string attr value]
|
||||
(when (some? node)
|
||||
(.setAttribute node (dm/str "data-" attr) (dm/str value))))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue