stuartpb / cre

A better way to construct DOM nodes.
MIT License
10 stars 1 forks source link

cre.HTML #6

Closed stuartpb closed 1 year ago

stuartpb commented 8 years ago

This could be an object with where every property is an HTML tag name, containing a function that constructs an element with that tag name (like a bound cre with the first parameter being that tag name), per this mailing list suggestion by @tabatkins.

The thing this would need, for me to add it, would be some way of reading the document's registry of tag names it recognizes for elements - however, since such a facility does not, to my knowledge, exist, this'll have to remain backburnered for now.

stuartpb commented 1 year ago

As of 3a6add1, cre.html is a self-alias - I don't think there's that much advantage to putting all the element creation functions under an object like this over just invoking new FooElement(). You can just provide the desired element name as the first parameter (and that won't struggle with custom element names, to boot). cre is sugary, but it's not that sugary.