re: Beyond appendChild: Better convenience methods for HTML VIEW POST

TOP OF THREAD FULL DISCUSSION
re: It never occurred to me to create new elements with object assign. 🔥 I always created the element then added properties and attributes after.
 

I nearly didn't include this one—it was added last. But I've seen a few people remark on how neat it is in some of my codebases, so I'm glad to share? 🤷

 

It's so useful when adding a bunch of properties to .style 🙂

Object.assign(el.style, {
 left: x + 'px',
 top: y + 'px'
});
code of conduct - report abuse