Code Monkey home page Code Monkey logo

b.udy.js's Introduction

b.udy.js ๐Ÿ•

A micro (0.8kb) DOM library! With only two purposes: facilitate the creation and manipulation of DOM elements.

npm version Build Status

npm install b.udy.js

basic usage

// load b.udy
var b = require('b.udy');

// to create a element and return it
var element = b('div').element();

// to load a existing element
b(element);

// to set element id
b(element).id('element-id');

// to set element className
b(element).className('element-class other-element-class');

// to add element attribute
b(element).attr('data-type', 'div');

// to remove element attribute
b(element).removeAttr('data-type', 'div');

// to add element listener
b(element).listener('click', clickListener);

// to remove element listener
b(element).removeListener('click', clickListener);

// to set multiple properties
b(element).id('element').className('element-class').listener('click', clickListener);

methods

  • b**(nodeType | element)**: Create or load a DOM element;
  • b.element(): Return the DOM element;
  • b.id(value): Set the DOM element id;
  • b.className(value): Set the DOM element className;
  • b.attr(key, value): Add a attribute to the DOM element;
  • b.removeAttr(key): Remove a attribute from the DOM element;
  • b.listener(eventType, callback): Add a event listener to the DOM element;
  • b.removeListener(eventType, callback): Remove a event listener from the DOM element;

support

  • chrome: latest;
  • firefox: latest;
  • safari: latest;
  • internet explore: 9+;

contribute

Everyone can contribute! Every contribution will be welcomed!

Fork it -> Branch it -> Test it -> Push it -> Pull Request it

b.udy.js's People

Contributors

evandroeisinger 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.