View Code? Open in Web Editor
NEW
Generate HTML DOM programmatically
Home Page: http://github.com/myme/elvis
License: ISC License
CoffeeScript 60.94%
JavaScript 39.06%
elvis's Introduction
๐ Hi, Iโm Martin!
๐ Iโm interested in nix ecosystem and functional programming in Haskell , but I mostly do professional work in Python and TypeScript .
๐ฑ Iโve been currently learning a bit of rust and go .
๐ซ Reach out to me through the footer links on my home page: https://myme.no .
elvis's People
Contributors
Stargazers
elvis's Issues
Convert HTML => JavaScript or CoffeeScript and vice versa.
Currently, setting properties does not work:
elvis (' button' , { disabled : false });
elvis (' button' , { disabled : true });
Should of course also work with bindings.
When an element only has one child, it could perhaps be nice to support a syntax like the following:
It seems like there's a DOM Exception thrown when elvis get's an int as its third argument. This should be handled gracefully by elvis.
Add ways to bind to properties on Collections as well.
Bind to length:
var collection = new Backbone . Collection ( ) ;
elvis ( 'div' , collection . bindTo ( 'length' ) ) ;
Bind to collection elements:
var collection = new Backbone . Collection ( ) ;
elvis ( 'ul' , collection . bindTo ( '[]' ) . get ( function ( elements ) {
return elements . map ( function ( element ) {
return elvis ( 'li' , element . get ( 'attribute' ) ) ;
} ) ;
} ) ) ;
Currently Backbone bindings are using .on
to register event listeners. When rendering Backbone views it's better to use .listenTo
to ensure that bindings are torn down when the view is destroyed.
elvis.on
is currently only using addEventListener
, which is not cross-browser compatible.
There are several early IE issues:
document.ELEMENT_NODE
and document.TEXT_NODE
are not defined constants on early IE version.
Emptying out a table element using innerHTML = ""
causes a runtime error.
textContent
is not supported on all IE versions. Use innerText
instead.
Text nodes do not support neither of textContent
nor innerText
and should be set using nodeValue
.