On Mon, Oct 2, 2017 at 8:17 AM, Boris Zbarsky <[email protected]> wrote:
> The fact is, direct DOM manipulation with no parser involved is really
> annoying to use.
>
Fair enough. Could we propose improvements to the APIs that would make
them more usable? For example an object argument to createElement() that
contained attribute/value pairs?
var div = document.createElement("div", null, {"id":"foo",
"class":"bar"});
parent.prepend(div);
(the null is for the existing custom elements options param)
Wordier than your parent.prepend("<div id=foo class=bar>") example, but
safer from developers trying to get clever with it. Such a short example
isn't going to fall victim to CSP blockage. In a longer example with src
URLs the overhead might not be too bad.
-
Dan Veditz
_______________________________________________
dev-platform mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-platform