jli v0.0.1
jli 
A small, jquery-like library
This is still very much a work in progress. I'm writing this for learning and for fun.
API
$(selector)
Finds an existing element on the dom or creates a new one
Options:
selector- string or instance of$
.append(element)
Adds an element as a child node
Options:
element- DOM node or instance of$
.remove(element)
Removes the
elementprovided from the parent or, if called without arguments, removes the current$element from the dom
Options:
element(optional) - DOM node or instance of$
.hasClass(className)
Returns
trueif the current$element has the providedclassName
Options:
className- string
.addClass(className)
Adds a class to the current
$element
Options:
className- string
.removeClass(className)
Removes a class from the current
$element
Options:
className- string
.html(html)
Either replaces the
innerHTMLof the current$element withhtmlor, if called without arguments, returns theinnerHTMLof the current$element
Options:
html(optional) - string
.text(text)
Either replaces the
innerHTMLof the current$element with html-escapedtextor, if called without arguments, returns theinnerHTMLof the current$element
Options:
text(optional) - string
.parent()
Returns the parent node of the current
$element
.closest(selector)
Returns the closest parent node of the current
$element matching the given selector
Examples
var $ = require('jli');
var $div = $('<div>');
$div.addClass('header');
$(document.body).append($div);
console.log($('body div').hasClass('header'));
//=> true9 years ago