GithubHelp home page GithubHelp logo

mark-wan / jbone Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kupriyanenko/jbone

0.0 1.0 0.0 1.32 MB

JavaScript Library for Events and DOM manipulation. Replaces jQuery for Backbone (2.5kb gzipped)

Home Page: http://jbone.js.org

License: MIT License

JavaScript 97.81% HTML 2.19%

jbone's Introduction

Meet jBone

Join the chat at https://gitter.im/kupriyanenko/jbone

Build Status Bower version npm version JS.ORG CDNJS.COM License GitHub Stats

jBone is very small and fast abstraction for Events and DOM manipulation in modern browsers with identical jQuery interfaces in most cases.

It replaces jQuery for Backbone in web and mobile applications (about 2.5kb gzipped, much faster than jQuery and Zepto).

Why jBone?

The main idea of jBone is to use native JavaScript methods as much as possible in your project.

It is superior solution for applications based on Backbone and running on mobile devices as it is extremely small (2.5kb) and really fast library.

jBone project was created to allow people to use Backbone without jQuery.

See benchmark results here.

Get it

Via bower
$ bower install jbone --save
Via component
component install kupriyanenko/jbone
Via 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 it 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 in jBone. You can choose one of a huge amount of AJAX implementations as well as standard Promises/A+ implementations.

For example: when, Q, simply-deferred, AJAX.

Example of AJAX connection:

// connect reqwest on your page https://rawgithub.com/ded/reqwest/master/reqwest.min.js

jBone.ajax = reqwest.compat;

$.ajax({
    url: "http://example.com"
});

Example of connection with Deferred Object:

// 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 11+
  • Safari 6+
  • iOS 5+ Safari
  • Android 2.3+ Browser
  • Chrome
  • Firefox

API

jBone

Attributes

Data

Event

Manipulation

Traversing

Utilities

Array methods

Internals

Running the Tests

Node

  1. npm install
  2. npm test

Browsers

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

jbone's People

Contributors

kupriyanenko avatar elprogresivo avatar emadalam avatar indus avatar gitter-badger avatar mindfreakthemon avatar igorbronowicki avatar mvasilkov avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.