####MaskJS DOM with jQuery syntax
Performance comparison jsperf. But jmask is not here to replace jQuery. It only handles MaskDOM creation and manipulation.
jmask("\
h1 > 'Header' \
div > ul { li > '1' li > '2' }")
.eq(1)
.attr('name', 'divname')
.find('ul')
.addClass('list-container')
.end()
.end()
.children('div')
.append("span > 'additional info'")
.end()
.appendTo(document.body);
Methods (each method is from jQuery counterpart):
mix
- Mask Markup, or Mask Dom
jmask(mix)
.add(mix)
.toArray()
.end()
.append(mix)
.prepend(mix)
.clone()
.wrap(mix)
.wrapAll(mix)
.empty()
.remove()
.mask(?mix) // jQuery ~ .html(?html)
// add TEXTNODE(s) to child elements in SET
.text(string)
// resolve text from all TEXTNODES, if there are inerpolation parts,
// you can pass model, cntx and controller to this function
.text(?model, ?cntx, ?controller)
.eq(index)
.get(index)
.slice(from,to)
.addClass(string)
.removeClass(?string)
.toggelClass(string)
.hasClass()
.attr
.removeAttr
.prop
.removeProp
.css
// Selectors:
// By TagName, Class, Id, Attribute:
// e.g.: 'div', '#perid', '.perclass', 'div[name=any]'
// Nestings:
// e.g.: foo>bar, >qux, >foo>*, foo bar,
.find(selector)
.closest(selector)
.parent(?selector)
.filter(selector)
.children(?selector)
.first(?selector)
.last(?selector)
// mask render
.render(?model, ?ctx, ?container) //-> HTMLNode | DocumentFragment
.appendTo(HTMLNode, ?model, ?ctx)
©️ 2015 - MIT - The Atma.js Project