Svan is a small vanilla jquery-like lib for web purpose.
Go to file
2015-12-17 01:33:02 +01:00
src rename method + add README 2015-12-17 01:33:02 +01:00
demo.html initial commit 2015-12-16 02:25:54 +01:00
README.md rename method + add README 2015-12-17 01:33:02 +01:00

Svan

Svan is a small vanilla jquery-like lib for web purpose.
small : 7.2 ko in normal version, 3.4 ko in minified version
it intends to produce more usefull jquery api in pur javascript.

var s = $(selector);

traversing

s.first()
s.last()
s.index(i)         // svan specific return node matching selector at given index i
s.each(fn)
s.find(selector)
s.all()            // svan specific return nodes matching selector as array

dom

s.append(htmlStr)
s.html(htmlStr)
s.html()
s.val()
s.val(data)
s.attr(key)
s.attr(key, value)

css

s.hasClass(cssName)
s.addClass(cssName)
s.removeClass(cssName)
s.toggle(cssName)

event

$(document).ready
s.on(type, handler, capture)

effects

s.fadeIn()
s.fadeIn(duration, callback)
s.fadeOut()
s.fadeOut(duration, callback)

ajax (currently in dev)

s.ajax({
    async   : ...,
    url     : ...,
    method  : ...,
    data    : ...,
    done    : ...,
    fail    : ...,
    always  : ...,
    before  : ...,
    timeout : ...,
})