Re: Convenient way to create element and set its attributes at once
Rick Waldron <[email protected]>
| Newsgroups | gmane.comp.web.dom.general |
|---|---|
| Message-ID | <CAHfnhfr1UO0V19A7HVB7rfQAYKdLGC28JiQQP-W9qtxPDXTkWA@mail.gmail.com> |
On Mon, Dec 2, 2013 at 9:39 PM, Tab Atkins Jr. <[email protected]> wrote: > On Mon, Dec 2, 2013 at 6:05 PM, Rick Waldron <[email protected]> > wrote: > > Yes, and it's not just you—the "single function/constructor/method that > > accepts a string and produces a node" is a common pattern implemented by > all > > major libraries: > > > > Y.Node.create("<div>"); > > jQuery("<div>"); > > dojo.create("div"); > > new Element("div"); > > new Ext.dom.Element("div"); > > There's *also* a common pattern of something like "HTML.h1()", for > simple "templating in JS" libraries. > References? Rick