http://kupriyanenko.github.io/jbone/
JavaScript Library for DOM manipulation in modern browsers with jQuery-compatible API.
Replacement jQuery for Backbone in browsers (2.5kb gzipped, faster than jQuery/Zepto)
jBone is extremely small (2.5kb) and realy fast library. Main jBone idea - it's as much as possible to use native JavaScript methods in your project.
jBone it is ideal solutions for applications based on Backbone and running on mobile devices. jBone project was created to allow people using Backbone without jQuery.
$ bower install jbone --save
component install kupriyanenko/jbone
$ npm install jbone --save
Add a <script>
element for jbone.js
<script src="path/to/jbone/dist/jbone.js"></script>
Or include like npm module (with nodejs or browserify)
var $ = require('jbone');
And write awesome code:
var $input = $("<input>", {
"class": "name"
}).val("John");
$input.on("click.space", function(e) {
console.log("clicked on", this);
});
$input.trigger("click");
$input.off(".space");
jBone.fn.addClass = function(className) {
var i = 0,
length = this.length;
for (; i < length; i++) {
this[i].classList.add(className);
}
return this;
};
$(".header").addClass("loaded");
This part is not covered on jBone. Yuo can select one of a huge amount implementations AJAX and Promises/A+.
For example: when, Q, simply-deferred, AJAX.
Example AJAX connecting:
// connect reqwest on your page https://rawgithub.com/ded/reqwest/master/reqwest.min.js
jBone.ajax = reqwest.compat;
$.ajax({
url: "http://example.com"
});
Example Deferred connecting:
// connect simply-deferred on your page https://rawgithub.com/sudhirj/simply-deferred/master/deferred.min.js
Deferred.installInto(jBone);
var deferred = $.Deferred();
$.when(deferred).then(function(response) {
// some code
});
- jBone(selector[, context])
- jBone(element)
- jBone(elementArray)
- jBone(jBoneObject)
- jBone(html[, attributes])
- .attr(attributeName)
- .attr(attributeName, value)
- .attr(attributes)
- .removeAttr(attributeName)
- .val()
- .val(value)
- .css(propertyName, value)
- .css(properties)
- .on(event[, selector], handler)
- .one(event[, selector], handler)
- .off(event[, handler])
- .trigger(event)
- jBone.merge(first, second)
- jBone.contains(container, contained)
- jBone.extend(target[, object1][, objectN])
- .pop()
- .push()
- .reverse()
- .shift()
- .sort()
- .splice()
- .unshift()
- .concat()
- .join()
- .slice()
- .indexOf()
- .forEach()
- .every()
- .some()
- .filter()
- .map()
- .reduce()
- .reduceRight()
npm install
npm test
bower install
- Open page with tests in browser
test/tests.html