lo

lightweight utility library for the browser

licenseMITgithublrsjng/lonpmlo
0.33.0

Lightweight utility library for the browser.

lo.dom()

Creates a new dom instance, this is an array-like collection of HTML elements.

// create elements
lo.dom('<div><span>hi</span></div>')

// select via document.querySelectorAll
lo.dom('div')

// select HTML elements directly
lo.dom(el)
lo.dom([el1, el2])

// run on doc ready
lo.dom(fn)

dom methods are:

.each(fn)
.map(fn)
.find(selector)
.on(type, fn)
.off(type, fn)
.attr(key, value)
.rm_attr(key)
.val(value)
.html(str)
.text(str)
.rm()
.rpl(arg)
.app(arg)
.app_to(arg)
.pre(arg)
.pre_to(arg)
.cls(...names)
.has_cls(name)
.add_cls(...names)
.rm_cls(...names)

lo.binder()

Creates a new binder instance.

// no options here
lo.binder()

binder methods are:

.log()
.add(name, ...els)
.set(name, val)
.on(name, fn)
.collect(root_el, split)
Works best with JavaScript enabled!Works best in modern browsers!