elements icon indicating copy to clipboard operation
elements copied to clipboard

Add html module that generates DOM nodes

Open arian opened this issue 12 years ago • 6 comments

Much like mootools-more Elements.from.

Especially with template engines like handlebars, moustache, and all those others that generate a string with html.

var html = require('elements/html')

html("<div>it's-a me, Mario!</div>").insert('#wrapper')

arian avatar Apr 10 '13 11:04 arian

I would rather name it it html2dom or elements or something :) Also a better example would be

  html("<div>it's-a me, Mario!</div><div>and Koopa Troopa!</div>").insert('#wrapper')

zalun avatar Apr 10 '13 13:04 zalun

var elements = require('elements')

elements.from("

it's-a me, Mario!
").insert('#wrapper')

?

On Wed, Apr 10, 2013 at 8:11 AM, Piotr Zalewa [email protected]:

I would rather name it it html2dom or something :)

— Reply to this email directly or view it on GitHubhttps://github.com/mootools/elements/issues/12#issuecomment-16172969 .

ibolmo avatar Apr 10 '13 16:04 ibolmo

@ibolmo :+1:

oskarkrawczyk avatar Apr 10 '13 16:04 oskarkrawczyk

@ibolmo no.

var whatchagonnacallit = require("elements/fromHTML")

namespacing is so 1999

kamicane avatar Apr 11 '13 10:04 kamicane

So, for example:

var elements = require('elements');
elements.from = require('elements/fromHTML');

:-D

timwienk avatar Apr 11 '13 10:04 timwienk

Yep that's all fine and dandy. You can obviously tell my example came from Python dependency system, haha.

On Thu, Apr 11, 2013 at 5:28 AM, Tim Wienk [email protected] wrote:

So, for example:

var elements = require('elements');elements.from = require('elements/fromHTML');

:-D

— Reply to this email directly or view it on GitHubhttps://github.com/mootools/elements/issues/12#issuecomment-16226963 .

ibolmo avatar Apr 11 '13 15:04 ibolmo