igorbronowicki / jbone

JavaScript Library for DOM manipulation. Replacement jQuery for Backbone in browsers (2.5kb gzipped)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

jBone

Build Status Bower version NPM version

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)

Why jBone?

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.

Get it

With bower
$ bower install jbone --save
With component
component install kupriyanenko/jbone
With nodejs or browserify
$ npm install jbone --save

Use it

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");

Extend it

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");

AJAX, Deferred

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
});

Browser support

Internet Explorer 9+

Safari 6+

iOS 5+ Safari

Android 2.3+ Browser

Chrome

Firefox

API

jBone

Attributes

Data

Event

Manipulation

Traversing

Utilities

Array methods

Running the Tests

Node

  1. npm install
  2. npm test

Browsers

  1. bower install
  2. Open page with tests in browser test/tests.html

About

JavaScript Library for DOM manipulation. Replacement jQuery for Backbone in browsers (2.5kb gzipped)

License:MIT License


Languages

Language:JavaScript 100.0%