Skip to content

Instantly share code, notes, and snippets.

View Arsonist-Cook's full-sized avatar

Cleiton Menezes Arsonist-Cook

View GitHub Profile
@Arsonist-Cook
Arsonist-Cook / _createElement.js
Created February 5, 2021 20:02
I give up having a bad time to undestand my DOM element declaration!!!
/**
* Here is the deal... I had a bad time having fun writing my DOM elements before showing them up...
* Bu, be sincere, its a pain having to copy and paste, even more when you have to configure step by step and the code becaming horible to read...
* Anyway, that was my forst idea of trying to make these configurations more declarative...
*/
_createElement({ tag, classList, attribute }) {
const element = document.createElement(tag);
if (classList && Array.isArray(classList)) {
element.classList.add(...classList);