My JavaScript book is out! Don't miss the opportunity to upgrade your beginner or average dev skills.

Thursday, December 07, 2006

The byte family is now complete, welcome bytedom

another "$" dollar function ? elements prototypes ? no, just a simple library with its namespace that doesn't modify anything else !
This is my last creation to complete my lightweight low-level framework that should be everything You need for your Web 2.0 sites or to develop more complex libraries too.

I've found EJ idea great but I always look for my own solutions.
I've thought about bytedom since I've created btefx but btesonwas more important than simply dom management (P.S. new byteson version 2.0b is available) but now I've completed what I need to develop my projects.

This is the bytedom method list:

  • addClassName, to add if not present a class name to an element

  • addEvent, to add a standard name event such click, load, mouseover and every other, DOMContentLoaded too

  • clear, to remove empty textnode from an entire document (FireFox, for example, reads newlines as textnodes)

  • create, to create one or more elements (input, div, span .. and every other)

  • every, a method like Array.every official JS 1.5 method, usable with a list of elements and arrays too

  • filter, same style of every, to get only what You need with your dedicated filter function

  • forEach, as every and filter, to do something with a list of nodes / elements or arrays too

  • get, something like dollar function, to get one or more elements with specified ids, lists of nodes of specified types or a list of elements with specified classNames

  • getStyle, to know a property of a specified element style

  • pop, to get and remove an element from a parent node

  • preventDefault, to prevent events defaults

  • push, to get and add an element at the end of a parent node (something like appendChild)

  • remove, to get and remove an element from a parent node

  • removeClassName, to remove a className, if present, from an node / element

  • removeEvent, to remove a standard name event such click, load, mouseover and every other, DOMContentLoaded too

  • replace, to get and replace a new node from a parent

  • reverse, to reverse the order of every child found inside a parent node

  • shift, to get and remove the first element of a parent node

  • some, as every, filter and forEach

  • text, to get and create one or more text nodes

  • toggle, to hide an element storing its old visibility and display style values ... and to assign them if element is toggled again

  • unshift, to add one or more element at the top of a parent node


These useful methods (at least in my humil opinion) let you get, modify, filter or manage dom elements in a simple, funnny (?) and JS friendly way.

This is just one of examples present in this page while this is a new anti pixel logo for people that use every byte library:
byte family
that with every member is less than 10 Kbytes for packer version, less than 15 Kbytes for clean crunched version and finally less than 7 for memtronic version.

Please sorry for incomplete bytedom site, I'll update API section as soon as I can.
Now, You could read about every method and parameters directly inside Open Source file version.

I hope you'll like new bytedom library and please tell me if something doesn't work correclty or some browser is not compatible (successful tested with IE5+, FF1+, Opera8+, Safri2+, KDE3.4+).

2 comments:

Anonymous said...

Hi Andrea, there'is a badlink to byte_family_memtronic.js.

I download your pack, now... think from your code I have much to learn.

(think my English is very worse then your :D, I speak Italian better)

Andrea Giammarchi said...

Thank You fra, the link now should work correctly.

Regards and Merry Christmas :-)