Overview

is an opensource jQuery-compatible module for working with CSS classes. It can be integrated into to a modular host library such as ender or can be used standalone. It delegates to the breakneck HTML5 classList API when possible and otherwise uses native fallback techniques. It is cross-browser compatible and gzips down under 1kb.

Methods

Static

Static (top-level) methods are designed to be fast and simple. Here elem is a native DOM element and className is a single CSS class. No typechecking is done. className coerces to a string. If className is an empty string (zero-length) then no change occurs.

Integrated

$.addClass(elem, className)
$.removeClass(elem, className)
$.toggleClass(elem, className)
$.hasClass(elem, className)

Standalone

vibe.addClass(elem, className)
vibe.removeClass(elem, className)
vibe.toggleClass(elem, className)
vibe.hasClass(elem, className)

Chain

Chain (effin) methods are designed to be jQuery-compatible. They operate on an array or array-like set of DOM elements. ssv is an array or space-separated string of class names, or a function to determine its value. Functions are scoped such that this is the current element. If the function returns false, further set iterations cease via break. If ssv is empty or an invalid type, then no change occurs.

Integrated

$(elems).addClass(ssv)
$(elems).removeClass(ssv)
$(elems).toggleClass(ssv)
$(elems).hasClass(className)

Standalone

vibe.fn.addClass.call(elems, ssv)
vibe.fn.removeClass.call(elems, ssv)
vibe.fn.toggleClass.call(elems, ssv)
vibe.fn.hasClass.call(elems, className)