/jquery.active_support.js

Additional support and utility functions

Primary LanguageJavaScript

Usage

Include in the head of your HTML page.

Depencies

jQuery 1.4.x

Methods

$.isBlank

Note: This is NOT the same function as a jQuery(‘selector’).is(‘:blank’).

$.isBlank(" ")       //true
$.isBlank("")        //true
$.isBlank("\n")      //true
$.isBlank("a")       //false

$.isBlank(null)      //true
$.isBlank(undefined) //true
$.isBlank([])        //true

$.isPresent (contrast to $.isBlank)

$.isPresent(" ")       //false
$.isPresent("")        //false
$.isPresent("\n")      //false
$.isPresent("a")       //true

$.isPresent(null)      //false
$.isPresent(undefined) //false
$.isPresent([])        //false

Testing

To run the tests, clone the repository and open ./spec/SpecRunner.html in any browser. For more info see jasmine.github.io/

Contributing

I would like to expand the available utility/support functions. Submit a pull request with your patch and the appropriate Jasmine test. I’ll gladly merge your changes into master :)