• Stars
    star
    112
  • Rank 302,123 (Top 7 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created almost 11 years ago
  • Updated almost 11 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

fasterDOM.js - faster DOM manipulation

fasterDOM.js 0.1

Fast DOM manipulation with "jquery-like" syntax and ~1.8Kb code.

Operations that are supported: .css(), .attr(), .html(), .append(), .prepend(), .show(), .hide() , .remove(), .each(), .get() (returns elements)

Selectors that are supported: By Id(#), by Class(.), by Name (@), by Tag(=)

The library is bound to $$, so you can use it like this $$(".elements").html() or $$("#element").css();

Performance

All the tests showed improvements to performance at least 30%.

Performance Tests can be found here: http://jsperf.com/testbndr

You can also run the tests on your own computer with test.html page. (Or here: http://bndr.me/fasterdom/test.html)

Example

var elements = $$(".elements");
var single_element = $$("#element");
var some_other_element = $$("=div");

elements.append("Some string to append").prepend(document.createElement("div"))
        .css({width:"1px",height:"20px"}).attr("some-attr","some-value").html("some html string").hide().show();

single_element.html(); // Returns html of the element
single_element.attr("some-attr"); // Returns attr from element
single_element.css(); // Returns css of element