Closed elShiaLabeouf closed 2 years ago
Thanks!
I'm curious why you changed from a for
statement to an Object.assign
. Do SVG elements not need to setAttribute
?
Splendid!
I assume if an HTML element (not only SVG) has a dataset, its data attributes are rendered by javascript automatically via an under-the-hood magic
Hey @jonobr1 :)
I've come up with a small fix for the data attributes that have 2+ hyphens. I didn't take into account that js
.dataset
property had data attributes in camelCase, which made it rendered like this:Found the proper way to copy dataset from an element to another here https://stackoverflow.com/a/20074111 Having this, data attributes are rendered accurately: