Skip to content

Instantly share code, notes, and snippets.

@chicagoworks
chicagoworks / jQuery.stringify.js
Created December 24, 2010 19:05
jQuery.stringify() utility
/**
* converted stringify() to jQuery plugin.
* serializes a simple object to a JSON formatted string.
* Note: stringify() is different from jQuery.serialize() which URLEncodes form elements
* UPDATES:
* Added a fix to skip over Object.prototype members added by the prototype.js library
* USAGE:
* jQuery.ajax({
@chicagoworks
chicagoworks / $.fn.delegate.js
Created December 24, 2010 18:48
Override jquery.delegate() to accept an object
/**
* Override .delegate()
* if 'selector' is an object loop over the object and call .live() for each item
* otherwise it call .live() just like the original .delegate().
* Roughly similar to the way the map is implemented in .bind().
*/
$.fn.delegate = function(selector, types, data, fn) {
if (typeof selector === "object") {
for (var sel in selector) {
for (var type in selector[sel]) {