Closed alejsanc closed 3 years ago
FWIW, this works already
const a = document.createElement('a');
paragraph.appendChild(a).setAttribute("href", "/article");
alternatives for more than a single attribute exist too:
Object.assign(
paragraph.appendChild(document.createElement('a')),
{
href: '/article',
title: 'cool article'
}
);
Those examples that you put are more complex than my example. That's why people use libraries and not the DOM directly.
Hey @alejsanc, thanks for your interest in improving the DOM Standard. I recommend working with the https://wicg.io/ community to turn this into a concrete proposal we can evaluate.
Thanks for the info annevk.
I think it would be convenient for the DOM API to evolve to a higher level of abstraction as some Javascript libraries allow with high level and chainable methods.
Example: