The kitchen sink library.
BlingJS is a kitchen sink, inspired by jQuery, but more consistent, and useful in the browser and on the server.
In particular, it is more consistent about doing set-based operations.
So, while it supports all the same basic operations as jQuery, they behave slightly different.
For instance, the
This set philosophy means that set operations are useful:
These kinds of set operations are part of the "core" plugin.
Everything is a plugin; since plugins can not only extend the prototype (by returning an object full of extensions), but can also inject code into the Bling constructor (by using $.hook), there is very little needed outside.
The core plugin also provides some cool new things, like the
.select() operation will collect a single property from every item in
.html()is short-hand for
.zap() operation is for doing bulk assignment.
.html("new html")is short-hand for
.zap('innerHTML', "new html").
More than just simple assignment, it can also 'stripe' values across a set; and map functions over selected properties.
$("li").zap('className', ["odd", "even"]) $("li").zap('childNodes.1.style.top', -> $.px @+10 )
This example moves every list-item's 2nd-child up by 10 pixels, and allows you to continue chaining on the list-items (not the moved children in this case).
% npm install bling % node > require("bling") > $([1,2,3,4]).scale(2.5).sum() 25