3 ms·
This is odd (public/scripts/TodoList.js): el.innerHTML = [ '<div class="items"></div>', '<div class="todo-item-input"></div>', ].join('\n'); I w
by armandososa 6y ago
This is odd (public/scripts/TodoList.js):
el.innerHTML = [
'<div class="items"></div>',
'<div class="todo-item-input"></div>',
].join('\n');
I wonder why aren't they using `DOM.createElement` instead of innerHTML since they will query for those nodes later anyway.
- morrvs 6y agoI've tried but I (surprisingly) found the string array to be the most readable way to do it without helpers. It's also easily replaced by ES6 templates when upgrading.
- masswerk 6y agoCounterintuitive fun fact: `HTMLElement.innerHTML = "string"` tends to be faster than `document.createElement()`.