Commits

Anonymous committed 1991f21

Check if array when a sorter is set

Comments (0)

Files changed (4)

 /*!
- * jQuery JavaScript Library v1.4.1
+ * jQuery JavaScript Library v1.4.2
  * http://jquery.com/
  *
  * Copyright 2010, John Resig
  * Copyright 2010, The Dojo Foundation
  * Released under the MIT, BSD, and GPL Licenses.
  *
- * Date: Mon Jan 25 19:43:33 2010 -0500
+ * Date: Sat Feb 13 22:33:48 2010 -0500
  */
 (function( window, undefined ) {
 
 			this.length = 1;
 			return this;
 		}
+		
+		// The body element only exists once, optimize finding it
+		if ( selector === "body" && !context ) {
+			this.context = document;
+			this[0] = document.body;
+			this.selector = "body";
+			this.length = 1;
+			return this;
+		}
 
 		// Handle HTML strings
 		if ( typeof selector === "string" ) {
 						ret = buildFragment( [ match[1] ], [ doc ] );
 						selector = (ret.cacheable ? ret.fragment.cloneNode(true) : ret.fragment).childNodes;
 					}
-
+					
+					return jQuery.merge( this, selector );
+					
 				// HANDLE: $("#id")
 				} else {
 					elem = document.getElementById( match[2] );
 				this.selector = selector;
 				this.context = document;
 				selector = document.getElementsByTagName( selector );
+				return jQuery.merge( this, selector );
 
 			// HANDLE: $(expr, $(...))
 			} else if ( !context || context.jquery ) {
 			this.context = selector.context;
 		}
 
-		return jQuery.isArray( selector ) ?
-			this.setArray( selector ) :
-			jQuery.makeArray( selector, this );
+		return jQuery.makeArray( selector, this );
 	},
 
 	// Start with an empty selector
 	selector: "",
 
 	// The current version of jQuery being used
-	jquery: "1.4.1",
+	jquery: "1.4.2",
 
 	// The default length of a jQuery object is 0
 	length: 0,
 	// (returning the new matched element set)
 	pushStack: function( elems, name, selector ) {
 		// Build a new jQuery matched element set
-		var ret = jQuery( elems || null );
+		var ret = jQuery();
+
+		if ( jQuery.isArray( elems ) ) {
+			push.apply( ret, elems );
+		
+		} else {
+			jQuery.merge( ret, elems );
+		}
 
 		// Add the old object onto the stack (as a reference)
 		ret.prevObject = this;
 		return ret;
 	},
 
-	// Force the current matched set of elements to become
-	// the specified array of elements (destroying the stack in the process)
-	// You should use pushStack() in order to do this, but maintain the stack
-	setArray: function( elems ) {
-		// Resetting the length to 0, then using the native Array push
-		// is a super-fast way to populate an object with array-like properties
-		this.length = 0;
-		push.apply( this, elems );
-
-		return this;
-	},
-
 	// Execute a callback for every element in the matched set.
 	// (You can seed the arguments with an array of args, but this is
 	// only used internally.)
 		if ( typeof data !== "string" || !data ) {
 			return null;
 		}
+
+		// Make sure leading/trailing whitespace is removed (IE can't handle it)
+		data = jQuery.trim( data );
 		
 		// Make sure the incoming data is actual JSON
 		// Logic borrowed from http://json.org/json2.js
 			for ( var l = second.length; j < l; j++ ) {
 				first[ i++ ] = second[ j ];
 			}
+		
 		} else {
 			while ( second[j] !== undefined ) {
 				first[ i++ ] = second[ j++ ];
 	}
 	
 	// Getting an attribute
-	return length ? fn( elems[0], key ) : null;
+	return length ? fn( elems[0], key ) : undefined;
 }
 
 function now() {
 		// (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
 		optSelected: document.createElement("select").appendChild( document.createElement("option") ).selected,
 
+		parentNode: div.removeChild( div.appendChild( document.createElement("div") ) ).parentNode === null,
+
 		// Will be defined later
+		deleteExpando: true,
 		checkClone: false,
 		scriptEval: false,
 		noCloneEvent: true,
 		delete window[ id ];
 	}
 
+	// Test to see if it's possible to delete an expando from an element
+	// Fails in Internet Explorer
+	try {
+		delete script.test;
+	
+	} catch(e) {
+		jQuery.support.deleteExpando = false;
+	}
+
 	root.removeChild( script );
 
 	if ( div.attachEvent && div.fireEvent ) {
 		document.body.appendChild( div );
 		jQuery.boxModel = jQuery.support.boxModel = div.offsetWidth === 2;
 		document.body.removeChild( div ).style.display = 'none';
+
 		div = null;
 	});
 
 	frameborder: "frameBorder"
 };
 var expando = "jQuery" + now(), uuid = 0, windowData = {};
-var emptyObject = {};
 
 jQuery.extend({
 	cache: {},
 
 		var id = elem[ expando ], cache = jQuery.cache, thisCache;
 
-		// Handle the case where there's no name immediately
-		if ( !name && !id ) {
+		if ( !id && typeof name === "string" && data === undefined ) {
 			return null;
 		}
 
 		if ( typeof name === "object" ) {
 			elem[ expando ] = id;
 			thisCache = cache[ id ] = jQuery.extend(true, {}, name);
-		} else if ( cache[ id ] ) {
-			thisCache = cache[ id ];
-		} else if ( typeof data === "undefined" ) {
-			thisCache = emptyObject;
-		} else {
-			thisCache = cache[ id ] = {};
-		}
+
+		} else if ( !cache[ id ] ) {
+			elem[ expando ] = id;
+			cache[ id ] = {};
+		}
+
+		thisCache = cache[ id ];
 
 		// Prevent overriding the named cache with undefined values
 		if ( data !== undefined ) {
-			elem[ expando ] = id;
 			thisCache[ name ] = data;
 		}
 
 
 		// Otherwise, we want to remove all of the element's data
 		} else {
-			// Clean up the element expando
-			try {
-				delete elem[ expando ];
-			} catch( e ) {
-				// IE has trouble directly removing the expando
-				// but it's ok with using removeAttribute
-				if ( elem.removeAttribute ) {
-					elem.removeAttribute( expando );
-				}
+			if ( jQuery.support.deleteExpando ) {
+				delete elem[ jQuery.expando ];
+
+			} else if ( elem.removeAttribute ) {
+				elem.removeAttribute( jQuery.expando );
 			}
 
 			// Completely remove the data cache
 						elem.className = value;
 
 					} else {
-						var className = " " + elem.className + " ";
+						var className = " " + elem.className + " ", setClass = elem.className;
 						for ( var c = 0, cl = classNames.length; c < cl; c++ ) {
 							if ( className.indexOf( " " + classNames[c] + " " ) < 0 ) {
-								elem.className += " " + classNames[c];
+								setClass += " " + classNames[c];
 							}
 						}
+						elem.className = jQuery.trim( setClass );
 					}
 				}
 			}
 						for ( var c = 0, cl = classNames.length; c < cl; c++ ) {
 							className = className.replace(" " + classNames[c] + " ", " ");
 						}
-						elem.className = className.substring(1, className.length - 1);
+						elem.className = jQuery.trim( className );
 
 					} else {
 						elem.className = "";
 		}
 
 		// elem is actually elem.style ... set the style
-		// Using attr for specific style information is now deprecated. Use style insead.
+		// Using attr for specific style information is now deprecated. Use style instead.
 		return jQuery.style( elem, name, value );
 	}
 });
-var fcleanup = function( nm ) {
-	return nm.replace(/[^\w\s\.\|`]/g, function( ch ) {
-		return "\\" + ch;
-	});
-};
+var rnamespaces = /\.(.*)$/,
+	fcleanup = function( nm ) {
+		return nm.replace(/[^\w\s\.\|`]/g, function( ch ) {
+			return "\\" + ch;
+		});
+	};
 
 /*
  * A number of helper functions used for managing events.
 			elem = window;
 		}
 
+		var handleObjIn, handleObj;
+
+		if ( handler.handler ) {
+			handleObjIn = handler;
+			handler = handleObjIn.handler;
+		}
+
 		// Make sure that the function being executed has a unique ID
 		if ( !handler.guid ) {
 			handler.guid = jQuery.guid++;
 		}
 
-		// if data is passed, bind to handler
-		if ( data !== undefined ) {
-			// Create temporary function pointer to original handler
-			var fn = handler;
-
-			// Create unique handler function, wrapped around original handler
-			handler = jQuery.proxy( fn );
-
-			// Store data in unique handler
-			handler.data = data;
-		}
-
 		// Init the element's event structure
-		var events = jQuery.data( elem, "events" ) || jQuery.data( elem, "events", {} ),
-			handle = jQuery.data( elem, "handle" ), eventHandle;
-
-		if ( !handle ) {
-			eventHandle = function() {
+		var elemData = jQuery.data( elem );
+
+		// If no elemData is found then we must be trying to bind to one of the
+		// banned noData elements
+		if ( !elemData ) {
+			return;
+		}
+
+		var events = elemData.events = elemData.events || {},
+			eventHandle = elemData.handle, eventHandle;
+
+		if ( !eventHandle ) {
+			elemData.handle = eventHandle = function() {
 				// Handle the second event of a trigger and when
 				// an event is called after a page has unloaded
 				return typeof jQuery !== "undefined" && !jQuery.event.triggered ?
 					jQuery.event.handle.apply( eventHandle.elem, arguments ) :
 					undefined;
 			};
-
-			handle = jQuery.data( elem, "handle", eventHandle );
-		}
-
-		// If no handle is found then we must be trying to bind to one of the
-		// banned noData elements
-		if ( !handle ) {
-			return;
 		}
 
 		// Add elem as a property of the handle function
-		// This is to prevent a memory leak with non-native
-		// event in IE.
-		handle.elem = elem;
+		// This is to prevent a memory leak with non-native events in IE.
+		eventHandle.elem = elem;
 
 		// Handle multiple events separated by a space
 		// jQuery(...).bind("mouseover mouseout", fn);
-		types = types.split( /\s+/ );
-
-		var type, i = 0;
+		types = types.split(" ");
+
+		var type, i = 0, namespaces;
 
 		while ( (type = types[ i++ ]) ) {
+			handleObj = handleObjIn ?
+				jQuery.extend({}, handleObjIn) :
+				{ handler: handler, data: data };
+
 			// Namespaced event handlers
-			var namespaces = type.split(".");
-			type = namespaces.shift();
-
-			if ( i > 1 ) {
-				handler = jQuery.proxy( handler );
-
-				if ( data !== undefined ) {
-					handler.data = data;
-				}
-			}
-
-			handler.type = namespaces.slice(0).sort().join(".");
+			if ( type.indexOf(".") > -1 ) {
+				namespaces = type.split(".");
+				type = namespaces.shift();
+				handleObj.namespace = namespaces.slice(0).sort().join(".");
+
+			} else {
+				namespaces = [];
+				handleObj.namespace = "";
+			}
+
+			handleObj.type = type;
+			handleObj.guid = handler.guid;
 
 			// Get the current list of functions bound to this event
 			var handlers = events[ type ],
-				special = this.special[ type ] || {};
+				special = jQuery.event.special[ type ] || {};
 
 			// Init the event handler queue
 			if ( !handlers ) {
-				handlers = events[ type ] = {};
+				handlers = events[ type ] = [];
 
 				// Check for a special event handler
 				// Only use addEventListener/attachEvent if the special
 				// events handler returns false
-				if ( !special.setup || special.setup.call( elem, data, namespaces, handler) === false ) {
+				if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
 					// Bind the global event handler to the element
 					if ( elem.addEventListener ) {
-						elem.addEventListener( type, handle, false );
+						elem.addEventListener( type, eventHandle, false );
+
 					} else if ( elem.attachEvent ) {
-						elem.attachEvent( "on" + type, handle );
+						elem.attachEvent( "on" + type, eventHandle );
 					}
 				}
 			}
 			
 			if ( special.add ) { 
-				var modifiedHandler = special.add.call( elem, handler, data, namespaces, handlers ); 
-				if ( modifiedHandler && jQuery.isFunction( modifiedHandler ) ) { 
-					modifiedHandler.guid = modifiedHandler.guid || handler.guid; 
-					modifiedHandler.data = modifiedHandler.data || handler.data; 
-					modifiedHandler.type = modifiedHandler.type || handler.type; 
-					handler = modifiedHandler; 
-				} 
-			} 
-			
+				special.add.call( elem, handleObj ); 
+
+				if ( !handleObj.handler.guid ) {
+					handleObj.handler.guid = handler.guid;
+				}
+			}
+
 			// Add the function to the element's handler list
-			handlers[ handler.guid ] = handler;
+			handlers.push( handleObj );
 
 			// Keep track of which events have been used, for global triggering
-			this.global[ type ] = true;
+			jQuery.event.global[ type ] = true;
 		}
 
 		// Nullify elem to prevent memory leaks in IE
 	global: {},
 
 	// Detach an event or set of events from an element
-	remove: function( elem, types, handler ) {
+	remove: function( elem, types, handler, pos ) {
 		// don't do events on text and comment nodes
 		if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
 			return;
 		}
 
-		var events = jQuery.data( elem, "events" ), ret, type, fn;
-
-		if ( events ) {
-			// Unbind all events for the element
-			if ( types === undefined || (typeof types === "string" && types.charAt(0) === ".") ) {
-				for ( type in events ) {
-					this.remove( elem, type + (types || "") );
+		var ret, type, fn, i = 0, all, namespaces, namespace, special, eventType, handleObj, origType,
+			elemData = jQuery.data( elem ),
+			events = elemData && elemData.events;
+
+		if ( !elemData || !events ) {
+			return;
+		}
+
+		// types is actually an event object here
+		if ( types && types.type ) {
+			handler = types.handler;
+			types = types.type;
+		}
+
+		// Unbind all events for the element
+		if ( !types || typeof types === "string" && types.charAt(0) === "." ) {
+			types = types || "";
+
+			for ( type in events ) {
+				jQuery.event.remove( elem, type + types );
+			}
+
+			return;
+		}
+
+		// Handle multiple events separated by a space
+		// jQuery(...).unbind("mouseover mouseout", fn);
+		types = types.split(" ");
+
+		while ( (type = types[ i++ ]) ) {
+			origType = type;
+			handleObj = null;
+			all = type.indexOf(".") < 0;
+			namespaces = [];
+
+			if ( !all ) {
+				// Namespaced event handlers
+				namespaces = type.split(".");
+				type = namespaces.shift();
+
+				namespace = new RegExp("(^|\\.)" + 
+					jQuery.map( namespaces.slice(0).sort(), fcleanup ).join("\\.(?:.*\\.)?") + "(\\.|$)")
+			}
+
+			eventType = events[ type ];
+
+			if ( !eventType ) {
+				continue;
+			}
+
+			if ( !handler ) {
+				for ( var j = 0; j < eventType.length; j++ ) {
+					handleObj = eventType[ j ];
+
+					if ( all || namespace.test( handleObj.namespace ) ) {
+						jQuery.event.remove( elem, origType, handleObj.handler, j );
+						eventType.splice( j--, 1 );
+					}
 				}
-			} else {
-				// types is actually an event object here
-				if ( types.type ) {
-					handler = types.handler;
-					types = types.type;
-				}
-
-				// Handle multiple events separated by a space
-				// jQuery(...).unbind("mouseover mouseout", fn);
-				types = types.split(/\s+/);
-				var i = 0;
-				while ( (type = types[ i++ ]) ) {
-					// Namespaced event handlers
-					var namespaces = type.split(".");
-					type = namespaces.shift();
-					var all = !namespaces.length,
-						cleaned = jQuery.map( namespaces.slice(0).sort(), fcleanup ),
-						namespace = new RegExp("(^|\\.)" + cleaned.join("\\.(?:.*\\.)?") + "(\\.|$)"),
-						special = this.special[ type ] || {};
-
-					if ( events[ type ] ) {
-						// remove the given handler for the given type
-						if ( handler ) {
-							fn = events[ type ][ handler.guid ];
-							delete events[ type ][ handler.guid ];
-
-						// remove all handlers for the given type
-						} else {
-							for ( var handle in events[ type ] ) {
-								// Handle the removal of namespaced events
-								if ( all || namespace.test( events[ type ][ handle ].type ) ) {
-									delete events[ type ][ handle ];
-								}
-							}
+
+				continue;
+			}
+
+			special = jQuery.event.special[ type ] || {};
+
+			for ( var j = pos || 0; j < eventType.length; j++ ) {
+				handleObj = eventType[ j ];
+
+				if ( handler.guid === handleObj.guid ) {
+					// remove the given handler for the given type
+					if ( all || namespace.test( handleObj.namespace ) ) {
+						if ( pos == null ) {
+							eventType.splice( j--, 1 );
 						}
 
 						if ( special.remove ) {
-							special.remove.call( elem, namespaces, fn);
-						}
-
-						// remove generic event handler if no more handlers exist
-						for ( ret in events[ type ] ) {
-							break;
-						}
-						if ( !ret ) {
-							if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) {
-								if ( elem.removeEventListener ) {
-									elem.removeEventListener( type, jQuery.data( elem, "handle" ), false );
-								} else if ( elem.detachEvent ) {
-									elem.detachEvent( "on" + type, jQuery.data( elem, "handle" ) );
-								}
-							}
-							ret = null;
-							delete events[ type ];
+							special.remove.call( elem, handleObj );
 						}
 					}
+
+					if ( pos != null ) {
+						break;
+					}
 				}
 			}
 
-			// Remove the expando if it's no longer used
-			for ( ret in events ) {
-				break;
-			}
-			if ( !ret ) {
-				var handle = jQuery.data( elem, "handle" );
-				if ( handle ) {
-					handle.elem = null;
+			// remove generic event handler if no more handlers exist
+			if ( eventType.length === 0 || pos != null && eventType.length === 1 ) {
+				if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) {
+					removeEvent( elem, type, elemData.handle );
 				}
-				jQuery.removeData( elem, "events" );
-				jQuery.removeData( elem, "handle" );
+
+				ret = null;
+				delete events[ type ];
+			}
+		}
+
+		// Remove the expando if it's no longer used
+		if ( jQuery.isEmptyObject( events ) ) {
+			var handle = elemData.handle;
+			if ( handle ) {
+				handle.elem = null;
+			}
+
+			delete elemData.events;
+			delete elemData.handle;
+
+			if ( jQuery.isEmptyObject( elemData ) ) {
+				jQuery.removeData( elem );
 			}
 		}
 	},
 				event.stopPropagation();
 
 				// Only trigger if we've ever bound an event for it
-				if ( this.global[ type ] ) {
+				if ( jQuery.event.global[ type ] ) {
 					jQuery.each( jQuery.cache, function() {
 						if ( this.events && this.events[type] ) {
 							jQuery.event.trigger( event, data, this.handle.elem );
 
 		} else if ( !event.isDefaultPrevented() ) {
 			var target = event.target, old,
-				isClick = jQuery.nodeName(target, "a") && type === "click";
-
-			if ( !isClick && !(target && target.nodeName && jQuery.noData[target.nodeName.toLowerCase()]) ) {
+				isClick = jQuery.nodeName(target, "a") && type === "click",
+				special = jQuery.event.special[ type ] || {};
+
+			if ( (!special._default || special._default.call( elem, event ) === false) && 
+				!isClick && !(target && target.nodeName && jQuery.noData[target.nodeName.toLowerCase()]) ) {
+
 				try {
 					if ( target[ type ] ) {
 						// Make sure that we don't accidentally re-trigger the onFOO events
 							target[ "on" + type ] = null;
 						}
 
-						this.triggered = true;
+						jQuery.event.triggered = true;
 						target[ type ]();
 					}
 
 					target[ "on" + type ] = old;
 				}
 
-				this.triggered = false;
+				jQuery.event.triggered = false;
 			}
 		}
 	},
 
 	handle: function( event ) {
-		// returned undefined or false
-		var all, handlers;
+		var all, handlers, namespaces, namespace, events;
 
 		event = arguments[0] = jQuery.event.fix( event || window.event );
 		event.currentTarget = this;
 
 		// Namespaced event handlers
-		var namespaces = event.type.split(".");
-		event.type = namespaces.shift();
-
-		// Cache this now, all = true means, any handler
-		all = !namespaces.length && !event.exclusive;
-
-		var namespace = new RegExp("(^|\\.)" + namespaces.slice(0).sort().join("\\.(?:.*\\.)?") + "(\\.|$)");
-
-		handlers = ( jQuery.data(this, "events") || {} )[ event.type ];
-
-		for ( var j in handlers ) {
-			var handler = handlers[ j ];
-
-			// Filter the functions by class
-			if ( all || namespace.test(handler.type) ) {
-				// Pass in a reference to the handler function itself
-				// So that we can later remove it
-				event.handler = handler;
-				event.data = handler.data;
-
-				var ret = handler.apply( this, arguments );
-
-				if ( ret !== undefined ) {
-					event.result = ret;
-					if ( ret === false ) {
-						event.preventDefault();
-						event.stopPropagation();
+		all = event.type.indexOf(".") < 0 && !event.exclusive;
+
+		if ( !all ) {
+			namespaces = event.type.split(".");
+			event.type = namespaces.shift();
+			namespace = new RegExp("(^|\\.)" + namespaces.slice(0).sort().join("\\.(?:.*\\.)?") + "(\\.|$)");
+		}
+
+		var events = jQuery.data(this, "events"), handlers = events[ event.type ];
+
+		if ( events && handlers ) {
+			// Clone the handlers to prevent manipulation
+			handlers = handlers.slice(0);
+
+			for ( var j = 0, l = handlers.length; j < l; j++ ) {
+				var handleObj = handlers[ j ];
+
+				// Filter the functions by class
+				if ( all || namespace.test( handleObj.namespace ) ) {
+					// Pass in a reference to the handler function itself
+					// So that we can later remove it
+					event.handler = handleObj.handler;
+					event.data = handleObj.data;
+					event.handleObj = handleObj;
+	
+					var ret = handleObj.handler.apply( this, arguments );
+
+					if ( ret !== undefined ) {
+						event.result = ret;
+						if ( ret === false ) {
+							event.preventDefault();
+							event.stopPropagation();
+						}
+					}
+
+					if ( event.isImmediatePropagationStopped() ) {
+						break;
 					}
 				}
-
-				if ( event.isImmediatePropagationStopped() ) {
-					break;
-				}
-
 			}
 		}
 
 		},
 
 		live: {
-			add: function( proxy, data, namespaces, live ) {
-				jQuery.extend( proxy, data || {} );
-
-				proxy.guid += data.selector + data.live; 
-				data.liveProxy = proxy;
-
-				jQuery.event.add( this, data.live, liveHandler, data ); 
+			add: function( handleObj ) {
+				jQuery.event.add( this, handleObj.origType, jQuery.extend({}, handleObj, {handler: liveHandler}) ); 
+			},
+
+			remove: function( handleObj ) {
+				var remove = true,
+					type = handleObj.origType.replace(rnamespaces, "");
 				
-			},
-
-			remove: function( namespaces ) {
-				if ( namespaces.length ) {
-					var remove = 0, name = new RegExp("(^|\\.)" + namespaces[0] + "(\\.|$)");
-
-					jQuery.each( (jQuery.data(this, "events").live || {}), function() {
-						if ( name.test(this.type) ) {
-							remove++;
-						}
-					});
-
-					if ( remove < 1 ) {
-						jQuery.event.remove( this, namespaces[0], liveHandler );
+				jQuery.each( jQuery.data(this, "events").live || [], function() {
+					if ( type === this.origType.replace(rnamespaces, "") ) {
+						remove = false;
+						return false;
 					}
+				});
+
+				if ( remove ) {
+					jQuery.event.remove( this, handleObj.origType, liveHandler );
 				}
-			},
-			special: {}
+			}
+
 		},
+
 		beforeunload: {
-			setup: function( data, namespaces, fn ) {
+			setup: function( data, namespaces, eventHandle ) {
 				// We only want to do this special case on windows
 				if ( this.setInterval ) {
-					this.onbeforeunload = fn;
+					this.onbeforeunload = eventHandle;
 				}
 
 				return false;
 			},
-			teardown: function( namespaces, fn ) {
-				if ( this.onbeforeunload === fn ) {
+			teardown: function( namespaces, eventHandle ) {
+				if ( this.onbeforeunload === eventHandle ) {
 					this.onbeforeunload = null;
 				}
 			}
 	}
 };
 
+var removeEvent = document.removeEventListener ?
+	function( elem, type, handle ) {
+		elem.removeEventListener( type, handle, false );
+	} : 
+	function( elem, type, handle ) {
+		elem.detachEvent( "on" + type, handle );
+	};
+
 jQuery.Event = function( src ) {
 	// Allow instantiation without the 'new' keyword
 	if ( !this.preventDefault ) {
 	// Check if mouse(over|out) are still within the same parent element
 	var parent = event.relatedTarget;
 
-	// Traverse up the tree
-	while ( parent && parent !== this ) {
-		// Firefox sometimes assigns relatedTarget a XUL element
-		// which we cannot access the parentNode property of
-		try {
+	// Firefox sometimes assigns relatedTarget a XUL element
+	// which we cannot access the parentNode property of
+	try {
+		// Traverse up the tree
+		while ( parent && parent !== this ) {
 			parent = parent.parentNode;
-
-		// assuming we've left the element since we most likely mousedover a xul element
-		} catch(e) {
-			break;
-		}
-	}
-
-	if ( parent !== this ) {
-		// set the correct event type
-		event.type = event.data;
-
-		// handle event if we actually just moused on to a non sub-element
-		jQuery.event.handle.apply( this, arguments );
-	}
-
+		}
+
+		if ( parent !== this ) {
+			// set the correct event type
+			event.type = event.data;
+
+			// handle event if we actually just moused on to a non sub-element
+			jQuery.event.handle.apply( this, arguments );
+		}
+
+	// assuming we've left the element since we most likely mousedover a xul element
+	} catch(e) { }
 },
 
 // In case of event delegation, we only need to rename the event.type,
 // submit delegation
 if ( !jQuery.support.submitBubbles ) {
 
-jQuery.event.special.submit = {
-	setup: function( data, namespaces, fn ) {
-		if ( this.nodeName.toLowerCase() !== "form" ) {
-			jQuery.event.add(this, "click.specialSubmit." + fn.guid, function( e ) {
-				var elem = e.target, type = elem.type;
-
-				if ( (type === "submit" || type === "image") && jQuery( elem ).closest("form").length ) {
-					return trigger( "submit", this, arguments );
-				}
-			});
+	jQuery.event.special.submit = {
+		setup: function( data, namespaces ) {
+			if ( this.nodeName.toLowerCase() !== "form" ) {
+				jQuery.event.add(this, "click.specialSubmit", function( e ) {
+					var elem = e.target, type = elem.type;
+
+					if ( (type === "submit" || type === "image") && jQuery( elem ).closest("form").length ) {
+						return trigger( "submit", this, arguments );
+					}
+				});
 	 
-			jQuery.event.add(this, "keypress.specialSubmit." + fn.guid, function( e ) {
-				var elem = e.target, type = elem.type;
-
-				if ( (type === "text" || type === "password") && jQuery( elem ).closest("form").length && e.keyCode === 13 ) {
-					return trigger( "submit", this, arguments );
-				}
-			});
-
-		} else {
-			return false;
-		}
-	},
-
-	remove: function( namespaces, fn ) {
-		jQuery.event.remove( this, "click.specialSubmit" + (fn ? "."+fn.guid : "") );
-		jQuery.event.remove( this, "keypress.specialSubmit" + (fn ? "."+fn.guid : "") );
-	}
-};
+				jQuery.event.add(this, "keypress.specialSubmit", function( e ) {
+					var elem = e.target, type = elem.type;
+
+					if ( (type === "text" || type === "password") && jQuery( elem ).closest("form").length && e.keyCode === 13 ) {
+						return trigger( "submit", this, arguments );
+					}
+				});
+
+			} else {
+				return false;
+			}
+		},
+
+		teardown: function( namespaces ) {
+			jQuery.event.remove( this, ".specialSubmit" );
+		}
+	};
 
 }
 
 // change delegation, happens here so we have bind.
 if ( !jQuery.support.changeBubbles ) {
 
-var formElems = /textarea|input|select/i;
-
-function getVal( elem ) {
-	var type = elem.type, val = elem.value;
-
-	if ( type === "radio" || type === "checkbox" ) {
-		val = elem.checked;
-
-	} else if ( type === "select-multiple" ) {
-		val = elem.selectedIndex > -1 ?
-			jQuery.map( elem.options, function( elem ) {
-				return elem.selected;
-			}).join("-") :
-			"";
-
-	} else if ( elem.nodeName.toLowerCase() === "select" ) {
-		val = elem.selectedIndex;
-	}
-
-	return val;
-}
-
-function testChange( e ) {
+	var formElems = /textarea|input|select/i,
+
+	changeFilters,
+
+	getVal = function( elem ) {
+		var type = elem.type, val = elem.value;
+
+		if ( type === "radio" || type === "checkbox" ) {
+			val = elem.checked;
+
+		} else if ( type === "select-multiple" ) {
+			val = elem.selectedIndex > -1 ?
+				jQuery.map( elem.options, function( elem ) {
+					return elem.selected;
+				}).join("-") :
+				"";
+
+		} else if ( elem.nodeName.toLowerCase() === "select" ) {
+			val = elem.selectedIndex;
+		}
+
+		return val;
+	},
+
+	testChange = function testChange( e ) {
 		var elem = e.target, data, val;
 
 		if ( !formElems.test( elem.nodeName ) || elem.readOnly ) {
 			e.type = "change";
 			return jQuery.event.trigger( e, arguments[1], elem );
 		}
-}
-
-jQuery.event.special.change = {
-	filters: {
-		focusout: testChange, 
-
-		click: function( e ) {
-			var elem = e.target, type = elem.type;
-
-			if ( type === "radio" || type === "checkbox" || elem.nodeName.toLowerCase() === "select" ) {
-				return testChange.call( this, e );
+	};
+
+	jQuery.event.special.change = {
+		filters: {
+			focusout: testChange, 
+
+			click: function( e ) {
+				var elem = e.target, type = elem.type;
+
+				if ( type === "radio" || type === "checkbox" || elem.nodeName.toLowerCase() === "select" ) {
+					return testChange.call( this, e );
+				}
+			},
+
+			// Change has to be called before submit
+			// Keydown will be called before keypress, which is used in submit-event delegation
+			keydown: function( e ) {
+				var elem = e.target, type = elem.type;
+
+				if ( (e.keyCode === 13 && elem.nodeName.toLowerCase() !== "textarea") ||
+					(e.keyCode === 32 && (type === "checkbox" || type === "radio")) ||
+					type === "select-multiple" ) {
+					return testChange.call( this, e );
+				}
+			},
+
+			// Beforeactivate happens also before the previous element is blurred
+			// with this event you can't trigger a change event, but you can store
+			// information/focus[in] is not needed anymore
+			beforeactivate: function( e ) {
+				var elem = e.target;
+				jQuery.data( elem, "_change_data", getVal(elem) );
 			}
 		},
 
-		// Change has to be called before submit
-		// Keydown will be called before keypress, which is used in submit-event delegation
-		keydown: function( e ) {
-			var elem = e.target, type = elem.type;
-
-			if ( (e.keyCode === 13 && elem.nodeName.toLowerCase() !== "textarea") ||
-				(e.keyCode === 32 && (type === "checkbox" || type === "radio")) ||
-				type === "select-multiple" ) {
-				return testChange.call( this, e );
-			}
+		setup: function( data, namespaces ) {
+			if ( this.type === "file" ) {
+				return false;
+			}
+
+			for ( var type in changeFilters ) {
+				jQuery.event.add( this, type + ".specialChange", changeFilters[type] );
+			}
+
+			return formElems.test( this.nodeName );
 		},
 
-		// Beforeactivate happens also before the previous element is blurred
-		// with this event you can't trigger a change event, but you can store
-		// information/focus[in] is not needed anymore
-		beforeactivate: function( e ) {
-			var elem = e.target;
-
-			if ( elem.nodeName.toLowerCase() === "input" && elem.type === "radio" ) {
-				jQuery.data( elem, "_change_data", getVal(elem) );
-			}
-		}
-	},
-	setup: function( data, namespaces, fn ) {
-		for ( var type in changeFilters ) {
-			jQuery.event.add( this, type + ".specialChange." + fn.guid, changeFilters[type] );
-		}
-
-		return formElems.test( this.nodeName );
-	},
-	remove: function( namespaces, fn ) {
-		for ( var type in changeFilters ) {
-			jQuery.event.remove( this, type + ".specialChange" + (fn ? "."+fn.guid : ""), changeFilters[type] );
-		}
-
-		return formElems.test( this.nodeName );
-	}
-};
-
-var changeFilters = jQuery.event.special.change.filters;
-
+		teardown: function( namespaces ) {
+			jQuery.event.remove( this, ".specialChange" );
+
+			return formElems.test( this.nodeName );
+		}
+	};
+
+	changeFilters = jQuery.event.special.change.filters;
 }
 
 function trigger( type, elem, args ) {
 			return fn.apply( this, arguments );
 		}) : fn;
 
-		return type === "unload" && name !== "one" ?
-			this.one( type, data, fn ) :
-			this.each(function() {
-				jQuery.event.add( this, type, handler, data );
-			});
+		if ( type === "unload" && name !== "one" ) {
+			this.one( type, data, fn );
+
+		} else {
+			for ( var i = 0, l = this.length; i < l; i++ ) {
+				jQuery.event.add( this[i], type, handler, data );
+			}
+		}
+
+		return this;
 	};
 });
 
 			for ( var key in type ) {
 				this.unbind(key, type[key]);
 			}
-			return this;
-		}
-
-		return this.each(function() {
-			jQuery.event.remove( this, type, fn );
-		});
+
+		} else {
+			for ( var i = 0, l = this.length; i < l; i++ ) {
+				jQuery.event.remove( this[i], type, fn );
+			}
+		}
+
+		return this;
 	},
+	
+	delegate: function( selector, types, data, fn ) {
+		return this.live( types, data, fn, selector );
+	},
+	
+	undelegate: function( selector, types, fn ) {
+		if ( arguments.length === 0 ) {
+				return this.unbind( "live" );
+		
+		} else {
+			return this.die( types, null, fn, selector );
+		}
+	},
+	
 	trigger: function( type, data ) {
 		return this.each(function() {
 			jQuery.event.trigger( type, data, this );
 	}
 });
 
+var liveMap = {
+	focus: "focusin",
+	blur: "focusout",
+	mouseenter: "mouseover",
+	mouseleave: "mouseout"
+};
+
 jQuery.each(["live", "die"], function( i, name ) {
-	jQuery.fn[ name ] = function( types, data, fn ) {
-		var type, i = 0;
+	jQuery.fn[ name ] = function( types, data, fn, origSelector /* Internal Use Only */ ) {
+		var type, i = 0, match, namespaces, preType,
+			selector = origSelector || this.selector,
+			context = origSelector ? this : jQuery( this.context );
 
 		if ( jQuery.isFunction( data ) ) {
 			fn = data;
 			data = undefined;
 		}
 
-		types = (types || "").split( /\s+/ );
+		types = (types || "").split(" ");
 
 		while ( (type = types[ i++ ]) != null ) {
-			type = type === "focus" ? "focusin" : // focus --> focusin
-					type === "blur" ? "focusout" : // blur --> focusout
-					type === "hover" ? types.push("mouseleave") && "mouseenter" : // hover support
-					type;
-			
+			match = rnamespaces.exec( type );
+			namespaces = "";
+
+			if ( match )  {
+				namespaces = match[0];
+				type = type.replace( rnamespaces, "" );
+			}
+
+			if ( type === "hover" ) {
+				types.push( "mouseenter" + namespaces, "mouseleave" + namespaces );
+				continue;
+			}
+
+			preType = type;
+
+			if ( type === "focus" || type === "blur" ) {
+				types.push( liveMap[ type ] + namespaces );
+				type = type + namespaces;
+
+			} else {
+				type = (liveMap[ type ] || type) + namespaces;
+			}
+
 			if ( name === "live" ) {
 				// bind live handler
-				jQuery( this.context ).bind( liveConvert( type, this.selector ), {
-					data: data, selector: this.selector, live: type
-				}, fn );
+				context.each(function(){
+					jQuery.event.add( this, liveConvert( type, selector ),
+						{ data: data, selector: selector, handler: fn, origType: type, origHandler: fn, preType: preType } );
+				});
 
 			} else {
 				// unbind live handler
-				jQuery( this.context ).unbind( liveConvert( type, this.selector ), fn ? { guid: fn.guid + this.selector + type } : null );
+				context.unbind( liveConvert( type, selector ), fn );
 			}
 		}
 		
 
 function liveHandler( event ) {
 	var stop, elems = [], selectors = [], args = arguments,
-		related, match, fn, elem, j, i, l, data,
-		live = jQuery.extend({}, jQuery.data( this, "events" ).live);
+		related, match, handleObj, elem, j, i, l, data,
+		events = jQuery.data( this, "events" );
 
 	// Make sure we avoid non-left-click bubbling in Firefox (#3861)
-	if ( event.button && event.type === "click" ) {
+	if ( event.liveFired === this || !events || !events.live || event.button && event.type === "click" ) {
 		return;
 	}
 
-	for ( j in live ) {
-		fn = live[j];
-		if ( fn.live === event.type ||
-				fn.altLive && jQuery.inArray(event.type, fn.altLive) > -1 ) {
-
-			data = fn.data;
-			if ( !(data.beforeFilter && data.beforeFilter[event.type] && 
-					!data.beforeFilter[event.type](event)) ) {
-				selectors.push( fn.selector );
-			}
+	event.liveFired = this;
+
+	var live = events.live.slice(0);
+
+	for ( j = 0; j < live.length; j++ ) {
+		handleObj = live[j];
+
+		if ( handleObj.origType.replace( rnamespaces, "" ) === event.type ) {
+			selectors.push( handleObj.selector );
+
 		} else {
-			delete live[j];
+			live.splice( j--, 1 );
 		}
 	}
 
 	match = jQuery( event.target ).closest( selectors, event.currentTarget );
 
 	for ( i = 0, l = match.length; i < l; i++ ) {
-		for ( j in live ) {
-			fn = live[j];
-			elem = match[i].elem;
-			related = null;
-
-			if ( match[i].selector === fn.selector ) {
+		for ( j = 0; j < live.length; j++ ) {
+			handleObj = live[j];
+
+			if ( match[i].selector === handleObj.selector ) {
+				elem = match[i].elem;
+				related = null;
+
 				// Those two events require additional checking
-				if ( fn.live === "mouseenter" || fn.live === "mouseleave" ) {
-					related = jQuery( event.relatedTarget ).closest( fn.selector )[0];
+				if ( handleObj.preType === "mouseenter" || handleObj.preType === "mouseleave" ) {
+					related = jQuery( event.relatedTarget ).closest( handleObj.selector )[0];
 				}
 
 				if ( !related || related !== elem ) {
-					elems.push({ elem: elem, fn: fn });
+					elems.push({ elem: elem, handleObj: handleObj });
 				}
 			}
 		}
 	for ( i = 0, l = elems.length; i < l; i++ ) {
 		match = elems[i];
 		event.currentTarget = match.elem;
-		event.data = match.fn.data;
-		if ( match.fn.apply( match.elem, args ) === false ) {
+		event.data = match.handleObj.data;
+		event.handleObj = match.handleObj;
+
+		if ( match.handleObj.origHandler.apply( match.elem, args ) === false ) {
 			stop = false;
 			break;
 		}
 }
 
 function liveConvert( type, selector ) {
-	return "live." + (type ? type + "." : "") + selector.replace(/\./g, "`").replace(/ /g, "&");
+	return "live." + (type && type !== "*" ? type + "." : "") + selector.replace(/\./g, "`").replace(/ /g, "&");
 }
 
 jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
 
 // Perform a simple check to determine if the browser is capable of
 // converting a NodeList to an array using builtin methods.
+// Also verifies that the returned array holds DOM nodes
+// (which is not the case in the Blackberry browser)
 try {
-	Array.prototype.slice.call( document.documentElement.childNodes, 0 );
+	Array.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType;
 
 // Provide a fallback method if it does not work
 } catch(e){
 }
 
 var contains = document.compareDocumentPosition ? function(a, b){
-	return a.compareDocumentPosition(b) & 16;
+	return !!(a.compareDocumentPosition(b) & 16);
 } : function(a, b){
 	return a !== b && (a.contains ? a.contains(b) : true);
 };
 jQuery.expr = Sizzle.selectors;
 jQuery.expr[":"] = jQuery.expr.filters;
 jQuery.unique = Sizzle.uniqueSort;
-jQuery.getText = getText;
+jQuery.text = getText;
 jQuery.isXMLDoc = isXML;
 jQuery.contains = contains;
 
 	rselfClosing = /^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,
 	rtagName = /<([\w:]+)/,
 	rtbody = /<tbody/i,
-	rhtml = /<|&\w+;/,
+	rhtml = /<|&#?\w+;/,
+	rnocache = /<script|<object|<embed|<option|<style/i,
 	rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,  // checked="checked" or checked (html5)
 	fcloseTag = function( all, front, tag ) {
 		return rselfClosing.test( tag ) ?
 			return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) );
 		}
 
-		return jQuery.getText( this );
+		return jQuery.text( this );
 	},
 
 	wrapAll: function( html ) {
 			return set;
 		}
 	},
+	
+	// keepData is for internal use only--do not document
+	remove: function( selector, keepData ) {
+		for ( var i = 0, elem; (elem = this[i]) != null; i++ ) {
+			if ( !selector || jQuery.filter( selector, [ elem ] ).length ) {
+				if ( !keepData && elem.nodeType === 1 ) {
+					jQuery.cleanData( elem.getElementsByTagName("*") );
+					jQuery.cleanData( [ elem ] );
+				}
+
+				if ( elem.parentNode ) {
+					 elem.parentNode.removeChild( elem );
+				}
+			}
+		}
+		
+		return this;
+	},
+
+	empty: function() {
+		for ( var i = 0, elem; (elem = this[i]) != null; i++ ) {
+			// Remove element nodes and prevent memory leaks
+			if ( elem.nodeType === 1 ) {
+				jQuery.cleanData( elem.getElementsByTagName("*") );
+			}
+
+			// Remove any remaining nodes
+			while ( elem.firstChild ) {
+				elem.removeChild( elem.firstChild );
+			}
+		}
+		
+		return this;
+	},
 
 	clone: function( events ) {
 		// Do the clone
 				}
 
 				return jQuery.clean([html.replace(rinlinejQuery, "")
+					// Handle the case in IE 8 where action=/test/> self-closes a tag
+					.replace(/=([^="'>\s]+\/)>/g, '="$1">')
 					.replace(rleadingWhitespace, "")], ownerDocument)[0];
 			} else {
 				return this.cloneNode(true);
 				null;
 
 		// See if we can take a shortcut and just use innerHTML
-		} else if ( typeof value === "string" && !/<script/i.test( value ) &&
+		} else if ( typeof value === "string" && !rnocache.test( value ) &&
 			(jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value )) &&
 			!wrapMap[ (rtagName.exec( value ) || ["", ""])[1].toLowerCase() ] ) {
 
 		if ( this[0] && this[0].parentNode ) {
 			// Make sure that the elements are removed from the DOM before they are inserted
 			// this can help fix replacing a parent with child elements
-			if ( !jQuery.isFunction( value ) ) {
-				value = jQuery( value ).detach();
-
-			} else {
+			if ( jQuery.isFunction( value ) ) {
 				return this.each(function(i) {
 					var self = jQuery(this), old = self.html();
 					self.replaceWith( value.call( this, i, old ) );
 				});
 			}
 
+			if ( typeof value !== "string" ) {
+				value = jQuery(value).detach();
+			}
+
 			return this.each(function() {
 				var next = this.nextSibling, parent = this.parentNode;
 
 	},
 
 	domManip: function( args, table, callback ) {
-		var results, first, value = args[0], scripts = [];
+		var results, first, value = args[0], scripts = [], fragment, parent;
 
 		// We can't cloneNode fragments that contain checked, in WebKit
 		if ( !jQuery.support.checkClone && arguments.length === 3 && typeof value === "string" && rchecked.test( value ) ) {
 		}
 
 		if ( this[0] ) {
+			parent = value && value.parentNode;
+
 			// If we're in a fragment, just use that instead of building a new one
-			if ( args[0] && args[0].parentNode && args[0].parentNode.nodeType === 11 ) {
-				results = { fragment: args[0].parentNode };
+			if ( jQuery.support.parentNode && parent && parent.nodeType === 11 && parent.childNodes.length === this.length ) {
+				results = { fragment: parent };
+
 			} else {
 				results = buildFragment( args, this, scripts );
 			}
-
-			first = results.fragment.firstChild;
+			
+			fragment = results.fragment;
+			
+			if ( fragment.childNodes.length === 1 ) {
+				first = fragment = fragment.firstChild;
+			} else {
+				first = fragment.firstChild;
+			}
 
 			if ( first ) {
 				table = table && jQuery.nodeName( first, "tr" );
 						table ?
 							root(this[i], first) :
 							this[i],
-						results.cacheable || this.length > 1 || i > 0 ?
-							results.fragment.cloneNode(true) :
-							results.fragment
+						i > 0 || results.cacheable || this.length > 1  ?
+							fragment.cloneNode(true) :
+							fragment
 					);
 				}
 			}
 
-			if ( scripts ) {
+			if ( scripts.length ) {
 				jQuery.each( scripts, evalScript );
 			}
 		}
 }
 
 function buildFragment( args, nodes, scripts ) {
-	var fragment, cacheable, cacheresults, doc;
-
-	// webkit does not clone 'checked' attribute of radio inputs on cloneNode, so don't cache if string has a checked
-	if ( args.length === 1 && typeof args[0] === "string" && args[0].length < 512 && args[0].indexOf("<option") < 0 && (jQuery.support.checkClone || !rchecked.test( args[0] )) ) {
+	var fragment, cacheable, cacheresults,
+		doc = (nodes && nodes[0] ? nodes[0].ownerDocument || nodes[0] : document);
+
+	// Only cache "small" (1/2 KB) strings that are associated with the main document
+	// Cloning options loses the selected state, so don't cache them
+	// IE 6 doesn't like it when you put <object> or <embed> elements in a fragment
+	// Also, WebKit does not clone 'checked' attributes on cloneNode, so don't cache
+	if ( args.length === 1 && typeof args[0] === "string" && args[0].length < 512 && doc === document &&
+		!rnocache.test( args[0] ) && (jQuery.support.checkClone || !rchecked.test( args[0] )) ) {
+
 		cacheable = true;
 		cacheresults = jQuery.fragments[ args[0] ];
 		if ( cacheresults ) {
 	}
 
 	if ( !fragment ) {
-		doc = (nodes && nodes[0] ? nodes[0].ownerDocument || nodes[0] : document);
 		fragment = doc.createDocumentFragment();
 		jQuery.clean( args, doc, fragment, scripts );
 	}
 	replaceAll: "replaceWith"
 }, function( name, original ) {
 	jQuery.fn[ name ] = function( selector ) {
-		var ret = [], insert = jQuery( selector );
-
-		for ( var i = 0, l = insert.length; i < l; i++ ) {
-			var elems = (i > 0 ? this.clone(true) : this).get();
-			jQuery.fn[ original ].apply( jQuery(insert[i]), elems );
-			ret = ret.concat( elems );
-		}
-		return this.pushStack( ret, name, insert.selector );
-	};
-});
-
-jQuery.each({
-	// keepData is for internal use only--do not document
-	remove: function( selector, keepData ) {
-		if ( !selector || jQuery.filter( selector, [ this ] ).length ) {
-			if ( !keepData && this.nodeType === 1 ) {
-				jQuery.cleanData( this.getElementsByTagName("*") );
-				jQuery.cleanData( [ this ] );
-			}
-
-			if ( this.parentNode ) {
-				 this.parentNode.removeChild( this );
-			}
-		}
-	},
-
-	empty: function() {
-		// Remove element nodes and prevent memory leaks
-		if ( this.nodeType === 1 ) {
-			jQuery.cleanData( this.getElementsByTagName("*") );
-		}
-
-		// Remove any remaining nodes
-		while ( this.firstChild ) {
-			this.removeChild( this.firstChild );
-		}
-	}
-}, function( name, fn ) {
-	jQuery.fn[ name ] = function() {
-		return this.each( fn, arguments );
+		var ret = [], insert = jQuery( selector ),
+			parent = this.length === 1 && this[0].parentNode;
+		
+		if ( parent && parent.nodeType === 11 && parent.childNodes.length === 1 && insert.length === 1 ) {
+			insert[ original ]( this[0] );
+			return this;
+			
+		} else {
+			for ( var i = 0, l = insert.length; i < l; i++ ) {
+				var elems = (i > 0 ? this.clone(true) : this).get();
+				jQuery.fn[ original ].apply( jQuery(insert[i]), elems );
+				ret = ret.concat( elems );
+			}
+		
+			return this.pushStack( ret, name, insert.selector );
+		}
 	};
 });
 
 
 		var ret = [];
 
-		jQuery.each(elems, function( i, elem ) {
+		for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
 			if ( typeof elem === "number" ) {
 				elem += "";
 			}
 
 			if ( !elem ) {
-				return;
+				continue;
 			}
 
 			// Convert html string into DOM nodes
 					div.insertBefore( context.createTextNode( rleadingWhitespace.exec(elem)[0] ), div.firstChild );
 				}
 
-				elem = jQuery.makeArray( div.childNodes );
+				elem = div.childNodes;
 			}
 
 			if ( elem.nodeType ) {
 			} else {
 				ret = jQuery.merge( ret, elem );
 			}
-
-		});
+		}
 
 		if ( fragment ) {
 			for ( var i = 0; ret[i]; i++ ) {
 				if ( scripts && jQuery.nodeName( ret[i], "script" ) && (!ret[i].type || ret[i].type.toLowerCase() === "text/javascript") ) {
 					scripts.push( ret[i].parentNode ? ret[i].parentNode.removeChild( ret[i] ) : ret[i] );
+				
 				} else {
 					if ( ret[i].nodeType === 1 ) {
 						ret.splice.apply( ret, [i + 1, 0].concat(jQuery.makeArray(ret[i].getElementsByTagName("script"))) );
 	},
 	
 	cleanData: function( elems ) {
-		for ( var i = 0, elem, id; (elem = elems[i]) != null; i++ ) {
-			jQuery.event.remove( elem );
-			jQuery.removeData( elem );
+		var data, id, cache = jQuery.cache,
+			special = jQuery.event.special,
+			deleteExpando = jQuery.support.deleteExpando;
+		
+		for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
+			id = elem[ jQuery.expando ];
+			
+			if ( id ) {
+				data = cache[ id ];
+				
+				if ( data.events ) {
+					for ( var type in data.events ) {
+						if ( special[ type ] ) {
+							jQuery.event.remove( elem, type );
+
+						} else {
+							removeEvent( elem, type, data.handle );
+						}
+					}
+				}
+				
+				if ( deleteExpando ) {
+					delete elem[ jQuery.expando ];
+
+				} else if ( elem.removeAttribute ) {
+					elem.removeAttribute( jQuery.expando );
+				}
+				
+				delete cache[ id ];
+			}
 		}
 	}
 });
 	rquery = /\?/,
 	rts = /(\?|&)_=.*?(&|$)/,
 	rurl = /^(\w+:)?\/\/([^\/?#]+)/,
-	r20 = /%20/g;
+	r20 = /%20/g,
+
+	// Keep a copy of the old load method
+	_load = jQuery.fn.load;
 
 jQuery.fn.extend({
-	// Keep a copy of the old load
-	_load: jQuery.fn.load,
-
 	load: function( url, params, callback ) {
 		if ( typeof url !== "string" ) {
-			return this._load( url );
+			return _load.call( this, url );
 
 		// Don't do a request if no elements are being requested
 		} else if ( !this.length ) {
 			if ( jQuery.isArray(obj) ) {
 				// Serialize array item.
 				jQuery.each( obj, function( i, v ) {
-					if ( traditional ) {
+					if ( traditional || /\[\]$/.test( prefix ) ) {
 						// Treat each array item as a scalar.
 						add( prefix, v );
 					} else {
 	Copyright (c) 2010 Michael Cvilic - BeeBole.com
 
 	Thanks to Rog Peppe for the functional JS jump
-	revision: 2.35
+	revision: 2.36
 */
 
 var $p, pure = $p = function(){
 					buildArg(i, temp, filter, length - filtered);
 				}
 			}else{
-				if(typeof sorter !== 'undefined'){
+				if(a && typeof sorter !== 'undefined'){
 					error('sort is only available on arrays, not objects');
 				}
 				//loop on collections

libs/pure_packed.js

     Copyright (c) 2010 Michael Cvilic - BeeBole.com
 
 	Thanks to Rog Peppe for the functional JS jump
-    revision: 2.35
+    revision: 2.36
 */
-eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('9 $p,2z=$p=6(){9 a=2A[0],1X=J;7(y a===\'15\'){1X=2A[1]||J}8 $p.2B(a,1X)};$p.2B=6(q,r,t){9 t=2C(),1c=[];3p(y q){2D\'15\':1c=t.K(r||F,q);7(1c.x===0){G(\'1Y 1Z "\'+q+\'" 2E 20 2F\')}1G;2D\'A\':G(\'1Y 1Z 2G 21 A, 3q 22 Y\');1G;3r:1c=[q]}C(9 i=0,N=1c.x;i<N;i++){t[i]=1c[i]}t.x=N;9 u=\'3s\'+1H.2H(1H.2I()*2J)+\'23\',24=\'3t\'+1H.2H(1H.2I()*2J)+\'23\',25=/^(\\+)?([^\\@\\+]+)?\\@?([^\\+]+)?(\\+)?$/,2K={3u:\'3v\',3w:\'2L\'};8 t;6 G(e){3x(e);7(y 2M!==\'A\'){2M.3y(e);3z}3A(\'2z G: \'+e);}6 2C(){9 a=$p.11,f=6(){};f.U=a;f.U.I=a.I||I;f.U.O=a.O||O;f.U.P=a.P||P;f.U.K=a.K||K;f.U.3B=1o;f.U.3C=G;8 3D f()}6 26(b){8 b.26||(6(n){9 a=F.1p(\'3E\'),h;a.1I(n.2N(R));h=a.1q;a=16;8 h})(b)}6 1J(o){8 3F.U.3G.27(o)==="[2O 3H]"}6 1r(b,f){8 6(a){8 b(\'\'+f.27(a.17,a))}}6 28(a,b){b=b||F.3I();9 c,1s;C(9 n 1d a){c=F.1p(n);b.1I(c);7(y a[n]===\'2O\'){1s=28(a[n],c)}B{1s=F.1p(a[n]);c.1I(1s)}}8 1s};6 K(n,a){7(y n===\'15\'){a=n;n=J}7(y F.2P!==\'A\'){8(n||F).2P(a)}B{G(\'3J 3K 12 2Q 3L 29: 3M, 3N.5+, 3O+ 3P 3Q+\\n\\3R 3S 2Q 2a 22 3T, 3U 3V a 3W 3X/3Y 29 a 3Z Y 40\')}}6 2b(c,d){8 6(a){9 b=[c[0]],n=c.x,1K,1t,1L,1u;C(9 i=1;i<n;i++){1K=d[i](a);1t=c[i];7(1K===\'\'){1L=b[b.x-1];7((1u=1L.41(/[\\w]+=\\"?$/))>-1){b[b.x-1]=1L.2c(0,1u);1t=1t.42(1)}}b[b.x]=1K;b[b.x]=1t}8 b.2d(\'\')}}6 2R(p){9 m=p.1v(/^(\\w+)\\s*<-\\s*(\\S+)?$/);7(m===16){G(\'2e 18 2S: "\'+p+\'"\')}7(m[1]===\'1e\'){G(\'"1e<-..." 21 a 43 44 C 2f 45 46 47.\\n\\48 49 4a 2g C 22 18.\')}7(!m[2]||(m[2]&&(/17/i).12(m[2]))){m[2]=6(a){8 a.17}}8{2g:m[1],14:m[2]}}6 1f(c){7(y(c)===\'6\'){8 c}9 m=c.1v(/^[a-4b-Z$23][\\w$]*(\\.[\\w$-]*[^\\.])*$/);7(m===16){9 d=J,s=c,1M=[],1g=[],i=0,2h;7(/\\\'|\\"/.12(s.2T(0))){7(/\\\'|\\"/.12(s.2T(s.x-1))){2h=s.2c(1,s.x-1);8 6(){8 2h}}}B{2U((m=s.1v(/#\\{([^{}]+)\\}/))!==16){d=R;1M[i++]=s.2V(0,m.2W);1g[i]=1f(m[1]);s=s.2V(m.2W+m[0].x,s.x)}}7(!d){G(\'2e 4c Y 2X: \'+c)}1M[i]=s;8 2b(1M,1g)}m=c.1N(\'.\');8 6(a){9 b=a.17;7(!b){8\'\'}9 v=a[m[0]],i=0;7(v&&v.1e){b=v.1e;i+=1}9 n=m.x;C(;i<n;i++){7(!b){1G}b=b[m[i]]}8(!b&&b!==0)?\'\':b}}6 1w(c,d,e){9 f,V,Y,D,Q,L=[];7(y d===\'15\'){f=d;9 m=d.1v(25);7(!m){G(\'2e Y 2X: \'+d)}V=m[1];Y=m[2];D=m[3];Q=m[4];7(Y===\'.\'||(!Y&&D)){L[0]=c}B{L=t.K(c,Y)}7(!L||L.x===0){8 G(\'1Y 1x "\'+d+\'" 2E 20 2F 1d 2f 1Z\')}}B{V=d.V;D=d.D;Q=d.Q;L=[c]}7(V||Q){7(V&&Q){G(\'Q/V 2i 4d 4e 4f 2f 4g 4h\')}B 7(e){G(\'2Y Q/V/1h 4i 4j C 18 L\')}B 7(Q&&e){G(\'2i Q 29 18 (14: \'+f+\')\')}}9 g,19,W,1y,1i,1z;7(D){1y=(/^2j$/i).12(D);1i=(/^4k$/i).12(D);1z=1i?\'1j\':D;g=6(a,s){a.4l(24+D,s);7(1z 1d a&&!1y){a[1z]=\'\'}7(a.2Z===1){a.30(D);1i&&a.30(1z)}};7(1y){19=6(a){8 a.2j.4m}}B 7(1i){19=6(a){8 a.1j}}B{19=6(a){8 a.4n(D)}}7(1y||1i){W=6(s){8 s.1h(/\\"/g,\'&31;\')}}B{W=6(s){8 s.1h(/\\"/g,\'&31;\').1h(/\\s/g,\'&4o;\')}}}B{7(e){g=6(a,s){9 b=a.32;7(b){b.2k(F.33(s),a.4p);b.2l(a)}}}B{19=6(a){8 a.1q};g=6(a,s,b){7(b===R){a.1q=s}B{a.1q=\'\';a.1I(F.33(s))}}}W=6(s){8 s}}9 h;7(V){h=6(a,s){g(a,s+19(a),R)}}B 7(Q){h=6(a,s){g(a,19(a)+s,R)}}B{h=6(a,s){g(a,s)}}8{D:D,M:L,34:h,14:f,W:W}}6 1A(a,n){9 b=u+n+\':\';C(9 i=0;i<a.M.x;i++){a.34(a.M[i],b)}}6 2m(h,j,k,l,m){8 6(f){9 a=j(f),2n=f[h],1O={35:a},2o=0,x,2p=[],2q=6(b,c,d,e){f.1u=c.1u=b;f.1e=c.1e=a[b];f.35=a;y e!==\'A\'&&(f.x=e);7(y d===\'6\'&&!d(f)){2o++;8}2p.2r(k.27(c,f))};f[h]=1O;7(1J(a)){x=a.x||0;7(y l===\'6\'){a.1P(l)}C(9 i=0,N=x;i<N;i++){2q(i,1O,m,x-2o)}}B{7(y l!==\'A\'){G(\'1P 21 4q 4r 2a 4s, 20 4t\')}C(9 g 1d a){a.2s(g)&&2q(g,1O,m)}}y 2n!==\'A\'?f[h]=2n:4u f[h];8 2p.2d(\'\')}}6 2t(a,b,c,d){9 e=J,1k,2u,1B,H;C(H 1d c){7(c.2s(H)){7(H===\'1P\'){2u=c.1P;36}B 7(H===\'1B\'){1B=c.1B;36}7(e){G(\'2i 4v 4w 4x 4y 18 2a a L\')}1k=H;e=R}}7(!1k){G(\'2Y 18 2S\')}9 f=c[1k];7(y(f)===\'15\'||y(f)===\'6\'){c={};c[1k]={2G:f};8 2t(a,b,c,d)}9 g=2R(1k),1C=1f(g.14),L=1w(a,b,R),M=L.M;C(i=0;i<M.x;i++){9 h=M[i],1D=1o(h,f);d[d.x]=1r(L.W,2m(g.2g,1C,1D,2u,1B));L.M=[h];1A(L,d.x-1)}}6 37(n,d){9 e=n.4z(\'*\'),2v=[],1l={a:[],l:{}},z,1Q,i,N,j,1m,13,1R,2w;C(i=-1,N=e.x;i<N;i++){13=i>-1?e[i]:n;7(13.2Z===1&&13.1j!==\'\'){1R=13.1j.1N(\' \');C(j=0,1m=1R.x;j<1m;j++){2w=1R[j];z=38(2w,13.39);7(z!==J){1Q=(/4A/i).12(z.D);7(z.14.3a(\'@\')>-1||1Q){13.1j=13.1j.1h(\'@\'+z.D,\'\');7(1Q){z.D=J}}2v.2r({n:13,z:z})}}}}8 2v;6 38(c,a){9 b=c.1v(25),D=b[3]||2K[a],z={V:!!b[1],H:b[2],D:D,Q:!!b[4],14:c},i,N,1S,1T,X;C(i=1l.a.x-1;i>=0;i--){1S=1l.a[i];1T=1S.l[0];X=1T&&1T[z.H];7(y X!==\'A\'){z.H=1S.p+\'.\'+z.H;7(1l.l[z.H]===R){X=X[0]}1G}}7(y X===\'A\'){X=1J(d)?d[0][z.H]:d[z.H];7(y X===\'A\'){8 J}}7(1J(X)){1l.a.2r({l:X,p:z.H});1l.l[z.H]=R;z.t=\'18\'}B{z.t=\'3b\'}8 z}}6 1o(a,b,c,d){9 e=[];d=d||c&&37(a,c);7(c){9 j,1m,z,n,f,M,1C,1x,1D;2U(d.x>0){z=d[0].z;n=d[0].n;d.4B(0,1);7(z.t===\'3b\'){f=1w(n,z,J);1A(f,e.x);e[e.x]=1r(f.W,1f(z.H))}B{1C=1f(z.14);f=1w(n,z,R);M=f.M;C(j=0,1m=M.x;j<1m;j++){1x=M[j];1D=1o(1x,J,c,d);e[e.x]=1r(f.W,2m(z.14,1C,1D));f.M=[1x];1A(f,e.x-1)}}}}9 f,1n;C(9 g 1d b){7(b.2s(g)){1n=b[g];7(y(1n)===\'6\'||y(1n)===\'15\'){f=1w(a,g,J);1A(f,e.x);e[e.x]=1r(f.W,1f(1n))}B{2t(a,g,1n,e)}}}9 h=26(a),1g=[];h=h.1h(/<([^>]+)\\s(2L\\=""|4C)\\s?([^>]*)>/4D,"<$1 $3>");h=h.1N(24).2d(\'\');9 k=h.1N(u),p;C(9 i=1;i<k.x;i++){p=k[i];1g[i]=e[4E(p,10)];k[i]=p.2c(p.3a(\':\')+1)}8 2b(k,1g)}6 I(b,c,d){9 e=1o((d||E[0]).2N(R),b,c);8 6(a){8 e({17:a})}}6 O(a,b){9 c=y b===\'6\'?b:t.I(b,J,E[0]);C(9 i=0,N=E.x;i<N;i++){E[i]=2x(E[i],c(a,J))}17=16;8 E}6 P(a,b){9 c=t.I(b,a,E[0]);C(9 i=0,N=E.x;i<N;i++){E[i]=2x(E[i],c(a,J))}17=16;8 E}6 2x(a,b){9 c=a.39,1E,T,1a,4F={1F:{}};7((/3c|1U|3d/).12(c)){9 d={1U:{1F:\'2y\'},3c:{1F:{2y:\'1U\'}},3d:{1F:{3e:\'1U\'}}};T=28(d[c])}B 7((/2y|3e|4G/).12(c)){T=F.1p(\'1F\')}B{T=F.1p(\'4H\')}1a=a.32;1a.2k(T,a);1a.2l(a);T.2j.4I=\'4J\';T.1q=b;1E=T.4K;1a.2k(1E,T);1a.2l(T);a=1E;T=1E=1a=16;8 a}};$p.11={};$p.3f={1V:6(){7(y F.1b===\'A\'){$p.11.K=6(n,a){8 1V.4L(a,n)}}},3g:6(){7(y F.1b===\'A\'){$p.11.K=6(n,a){8 $(n).4M(a)}}3h.4N({4O:[\'I\',\'O\',\'P\'],I:6(a,b){8 $p(E).I(a,b)},O:6(a,b){8 $($p(E).O(a,b))[0]},P:6(a,b){8 $($p(E).P(a,b))[0]}})},3i:6(){7(y F.1b===\'A\'){$p.11.K=6(n,a){8 $(n).K(a)}}1W.4P.4Q({I:6(a,b){8 $p(E[0]).I(a,b)},O:6(a,b){8 1W($p(E[0]).O(a,b))},P:6(a,b){8 1W($p(E[0]).P(a,b))}})},3j:6(){7(y F.1b===\'A\'){$p.11.K=6(n,a){8 $(n).4R(a)}}3k.4S({I:6(a,b){8 $p(E).I(a,b)},O:6(a,b){8 $p(E).O(a,b)},P:6(a,b){8 $p(E).P(a,b)}})},U:6(){7(y F.1b===\'A\'){$p.11.K=6(n,a){n=n===F?n.4T:n;8 y n===\'15\'?$$(n):$(n).4U(a)}}3k.4V({I:6(a,b,c){8 $p(a).I(b,c)},O:6(a,b,c){8 $p(a).O(b,c)},P:6(a,b,c){8 $p(a).P(b,c)}})},3l:6(){7(y F.1b===\'A\'){$p.11.K=6(n,a){8 3m(a,n)}}},3n:6(){7(y F.1b===\'A\'){$p.11.K=6(n,a){8 3o(a,n)}}}};(6(){9 a=y 1V!==\'A\'&&\'1V\'||y 3h!==\'A\'&&\'3g\'||y 1W!==\'A\'&&\'3i\'||y 4W!==\'A\'&&\'3j\'||y 4X!==\'A\'&&\'U\'||y 3m!==\'A\'&&\'3l\'||y 3o!==\'A\'&&\'3n\';a&&$p.3f[a]()})();',62,308,'||||||function|if|return|var||||||||||||||||||||||||length|typeof|cspec|undefined|else|for|attr|this|document|error|prop|compile|false|find|target|nodes|ii|render|autoRender|append|true||pa|prototype|prepend|quotefn|val|selector|||plugins|test|ni|sel|string|null|context|loop|getstr|ep|querySelector|templates|in|item|dataselectfn|pfns|replace|isClass|className|ls|openLoops|jj|dsel|compiler|createElement|innerHTML|wrapquote|leaf|pVal|pos|match|gettarget|node|isStyle|attName|setsig|filter|itersel|inner|ne|TABLE|break|Math|appendChild|isArray|fnVal|attLine|parts|split|temp|sort|isNodeValue|cs|loopi|loopil|TR|dojo|jQuery|ctxt|The|template|not|is|your|_|attPfx|selRx|outerHTML|call|domify|with|on|concatenator|substring|join|bad|the|name|retStr|cannot|style|insertBefore|removeChild|loopfn|old|filtered|strs|buildArg|push|hasOwnProperty|loopgen|sorter|an|cj|replaceWith|TBODY|pure|arguments|core|getPlugins|case|was|found|root|floor|random|1000000|autoAttr|value|console|cloneNode|object|querySelectorAll|PURE|parseloopspec|spec|charAt|while|slice|index|syntax|no|nodeType|removeAttribute|quot|parentNode|createTextNode|set|items|continue|getAutoNodes|checkClass|tagName|indexOf|str|TD|TH|THEAD|libs|domassistant|DOMAssistant|jquery|mootools|Element|sizzle|Sizzle|sly|Sly|switch|check|default|_s|_a|IMG|src|INPUT|alert|log|debugger|throw|_compiler|_error|new|div|Object|toString|Array|createDocumentFragment|You|can|standalone|iPhone|FF3|Safari4|and|IE8|nTo|run|browser|you|need|JS|library|framework|CSS|engine|search|substr|reserved|word|current|running|iteration|nPlease|choose|another|zA|data|take|place|at|same|time|modifiers|allowed|class|setAttribute|cssText|getAttribute|nbsp|nextSibling|only|available|arrays|objects|delete|have|more|than|one|getElementsByTagName|nodevalue|splice|selected|ig|parseInt|parent|TFOOT|SPAN|display|none|firstChild|query|cssSelect|attach|publicMethods|fn|extend|getElements|implement|body|select|addMethods|MooTools|Prototype'.split('|'),0,{}))
+var $p,pure=$p=function(){var sel=arguments[0],ctxt=false;if(typeof sel==='string'){ctxt=arguments[1]||false}return $p.core(sel,ctxt)};$p.core=function(sel,ctxt,plugins){var plugins=getPlugins(),templates=[];switch(typeof sel){case'string':templates=plugins.find(ctxt||document,sel);if(templates.length===0){error('The template "'+sel+'" was not found')}break;case'undefined':error('The template root is undefined, check your selector');break;default:templates=[sel]}for(var i=0,ii=templates.length;i<ii;i++){plugins[i]=templates[i]}plugins.length=ii;var Sig='_s'+Math.floor(Math.random()*1000000)+'_',attPfx='_a'+Math.floor(Math.random()*1000000)+'_',selRx=/^(\+)?([^\@\+]+)?\@?([^\+]+)?(\+)?$/,autoAttr={IMG:'src',INPUT:'value'};return plugins;function error(e){alert(e);if(typeof console!=='undefined'){console.log(e);debugger}throw('pure error: '+e);}function getPlugins(){var plugins=$p.plugins,f=function(){};f.prototype=plugins;f.prototype.compile=plugins.compile||compile;f.prototype.render=plugins.render||render;f.prototype.autoRender=plugins.autoRender||autoRender;f.prototype.find=plugins.find||find;f.prototype._compiler=compiler;f.prototype._error=error;return new f()}function outerHTML(node){return node.outerHTML||(function(n){var div=document.createElement('div'),h;div.appendChild(n.cloneNode(true));h=div.innerHTML;div=null;return h})(node)}function isArray(o){return Object.prototype.toString.call(o)==="[object Array]"}function wrapquote(qfn,f){return function(ctxt){return qfn(''+f.call(ctxt.context,ctxt))}}function domify(ns,pa){pa=pa||document.createDocumentFragment();var nn,leaf;for(var n in ns){nn=document.createElement(n);pa.appendChild(nn);if(typeof ns[n]==='object'){leaf=domify(ns[n],nn)}else{leaf=document.createElement(ns[n]);nn.appendChild(leaf)}}return leaf};function find(n,sel){if(typeof n==='string'){sel=n;n=false}if(typeof document.querySelectorAll!=='undefined'){return(n||document).querySelectorAll(sel)}else{error('You can test PURE standalone with: iPhone, FF3.5+, Safari4+ and IE8+\n\nTo run PURE on your browser, you need a JS library/framework with a CSS selector engine')}}function concatenator(parts,fns){return function(ctxt){var strs=[parts[0]],n=parts.length,fnVal,pVal,attLine,pos;for(var i=1;i<n;i++){fnVal=fns[i](ctxt);pVal=parts[i];if(fnVal===''){attLine=strs[strs.length-1];if((pos=attLine.search(/[\w]+=\"?$/))>-1){strs[strs.length-1]=attLine.substring(0,pos);pVal=pVal.substr(1)}}strs[strs.length]=fnVal;strs[strs.length]=pVal}return strs.join('')}}function parseloopspec(p){var m=p.match(/^(\w+)\s*<-\s*(\S+)?$/);if(m===null){error('bad loop spec: "'+p+'"')}if(m[1]==='item'){error('"item<-..." is a reserved word for the current running iteration.\n\nPlease choose another name for your loop.')}if(!m[2]||(m[2]&&(/context/i).test(m[2]))){m[2]=function(ctxt){return ctxt.context}}return{name:m[1],sel:m[2]}}function dataselectfn(sel){if(typeof(sel)==='function'){return sel}var m=sel.match(/^[a-zA-Z$_][\w$]*(\.[\w$-]*[^\.])*$/);if(m===null){var found=false,s=sel,parts=[],pfns=[],i=0,retStr;if(/\'|\"/.test(s.charAt(0))){if(/\'|\"/.test(s.charAt(s.length-1))){retStr=s.substring(1,s.length-1);return function(){return retStr}}}else{while((m=s.match(/#\{([^{}]+)\}/))!==null){found=true;parts[i++]=s.slice(0,m.index);pfns[i]=dataselectfn(m[1]);s=s.slice(m.index+m[0].length,s.length)}}if(!found){error('bad data selector syntax: '+sel)}parts[i]=s;return concatenator(parts,pfns)}m=sel.split('.');return function(ctxt){var data=ctxt.context;if(!data){return''}var v=ctxt[m[0]],i=0;if(v&&v.item){data=v.item;i+=1}var n=m.length;for(;i<n;i++){if(!data){break}data=data[m[i]]}return(!data&&data!==0)?'':data}}function gettarget(dom,sel,isloop){var osel,prepend,selector,attr,append,target=[];if(typeof sel==='string'){osel=sel;var m=sel.match(selRx);if(!m){error('bad selector syntax: '+sel)}prepend=m[1];selector=m[2];attr=m[3];append=m[4];if(selector==='.'||(!selector&&attr)){target[0]=dom}else{target=plugins.find(dom,selector)}if(!target||target.length===0){return error('The node "'+sel+'" was not found in the template')}}else{prepend=sel.prepend;attr=sel.attr;append=sel.append;target=[dom]}if(prepend||append){if(prepend&&append){error('append/prepend cannot take place at the same time')}else if(isloop){error('no append/prepend/replace modifiers allowed for loop target')}else if(append&&isloop){error('cannot append with loop (sel: '+osel+')')}}var setstr,getstr,quotefn,isStyle,isClass,attName;if(attr){isStyle=(/^style$/i).test(attr);isClass=(/^class$/i).test(attr);attName=isClass?'className':attr;setstr=function(node,s){node.setAttribute(attPfx+attr,s);if(attName in node&&!isStyle){node[attName]=''}if(node.nodeType===1){node.removeAttribute(attr);isClass&&node.removeAttribute(attName)}};if(isStyle){getstr=function(node){return node.style.cssText}}else if(isClass){getstr=function(node){return node.className}}else{getstr=function(node){return node.getAttribute(attr)}}if(isStyle||isClass){quotefn=function(s){return s.replace(/\"/g,'&quot;')}}else{quotefn=function(s){return s.replace(/\"/g,'&quot;').replace(/\s/g,'&nbsp;')}}}else{if(isloop){setstr=function(node,s){var pn=node.parentNode;if(pn){pn.insertBefore(document.createTextNode(s),node.nextSibling);pn.removeChild(node)}}}else{getstr=function(node){return node.innerHTML};setstr=function(node,s,ap){if(ap===true){node.innerHTML=s}else{node.innerHTML='';node.appendChild(document.createTextNode(s))}}}quotefn=function(s){return s}}var setfn;if(prepend){setfn=function(node,s){setstr(node,s+getstr(node),true)}}else if(append){setfn=function(node,s){setstr(node,getstr(node)+s,true)}}else{setfn=function(node,s){setstr(node,s)}}return{attr:attr,nodes:target,set:setfn,sel:osel,quotefn:quotefn}}function setsig(target,n){var sig=Sig+n+':';for(var i=0;i<target.nodes.length;i++){target.set(target.nodes[i],sig)}}function loopfn(name,dselect,inner,sorter,filter){return function(ctxt){var a=dselect(ctxt),old=ctxt[name],temp={items:a},filtered=0,length,strs=[],buildArg=function(idx,temp,ftr,len){ctxt.pos=temp.pos=idx;ctxt.item=temp.item=a[idx];ctxt.items=a;typeof len!=='undefined'&&(ctxt.length=len);if(typeof ftr==='function'&&!ftr(ctxt)){filtered++;return}strs.push(inner.call(temp,ctxt))};ctxt[name]=temp;if(isArray(a)){length=a.length||0;if(typeof sorter==='function'){a.sort(sorter)}for(var i=0,ii=length;i<ii;i++){buildArg(i,temp,filter,length-filtered)}}else{if(a&&typeof sorter!=='undefined'){error('sort is only available on arrays, not objects')}for(var prop in a){a.hasOwnProperty(prop)&&buildArg(prop,temp,filter)}}typeof old!=='undefined'?ctxt[name]=old:delete ctxt[name];return strs.join('')}}function loopgen(dom,sel,loop,fns){var already=false,ls,sorter,filter,prop;for(prop in loop){if(loop.hasOwnProperty(prop)){if(prop==='sort'){sorter=loop.sort;continue}else if(prop==='filter'){filter=loop.filter;continue}if(already){error('cannot have more than one loop on a target')}ls=prop;already=true}}if(!ls){error('no loop spec')}var dsel=loop[ls];if(typeof(dsel)==='string'||typeof(dsel)==='function'){loop={};loop[ls]={root:dsel};return loopgen(dom,sel,loop,fns)}var spec=parseloopspec(ls),itersel=dataselectfn(spec.sel),target=gettarget(dom,sel,true),nodes=target.nodes;for(i=0;i<nodes.length;i++){var node=nodes[i],inner=compiler(node,dsel);fns[fns.length]=wrapquote(target.quotefn,loopfn(spec.name,itersel,inner,sorter,filter));target.nodes=[node];setsig(target,fns.length-1)}}function getAutoNodes(n,data){var ns=n.getElementsByTagName('*'),an=[],openLoops={a:[],l:{}},cspec,isNodeValue,i,ii,j,jj,ni,cs,cj;for(i=-1,ii=ns.length;i<ii;i++){ni=i>-1?ns[i]:n;if(ni.nodeType===1&&ni.className!==''){cs=ni.className.split(' ');for(j=0,jj=cs.length;j<jj;j++){cj=cs[j];cspec=checkClass(cj,ni.tagName);if(cspec!==false){isNodeValue=(/nodevalue/i).test(cspec.attr);if(cspec.sel.indexOf('@')>-1||isNodeValue){ni.className=ni.className.replace('@'+cspec.attr,'');if(isNodeValue){cspec.attr=false}}an.push({n:ni,cspec:cspec})}}}}return an;function checkClass(c,tagName){var ca=c.match(selRx),attr=ca[3]||autoAttr[tagName],cspec={prepend:!!ca[1],prop:ca[2],attr:attr,append:!!ca[4],sel:c},i,ii,loopi,loopil,val;for(i=openLoops.a.length-1;i>=0;i--){loopi=openLoops.a[i];loopil=loopi.l[0];val=loopil&&loopil[cspec.prop];if(typeof val!=='undefined'){cspec.prop=loopi.p+'.'+cspec.prop;if(openLoops.l[cspec.prop]===true){val=val[0]}break}}if(typeof val==='undefined'){val=isArray(data)?data[0][cspec.prop]:data[cspec.prop];if(typeof val==='undefined'){return false}}if(isArray(val)){openLoops.a.push({l:val,p:cspec.prop});openLoops.l[cspec.prop]=true;cspec.t='loop'}else{cspec.t='str'}return cspec}}function compiler(dom,directive,data,ans){var fns=[];ans=ans||data&&getAutoNodes(dom,data);if(data){var j,jj,cspec,n,target,nodes,itersel,node,inner;while(ans.length>0){cspec=ans[0].cspec;n=ans[0].n;ans.splice(0,1);if(cspec.t==='str'){target=gettarget(n,cspec,false);setsig(target,fns.length);fns[fns.length]=wrapquote(target.quotefn,dataselectfn(cspec.prop))}else{itersel=dataselectfn(cspec.sel);target=gettarget(n,cspec,true);nodes=target.nodes;for(j=0,jj=nodes.length;j<jj;j++){node=nodes[j];inner=compiler(node,false,data,ans);fns[fns.length]=wrapquote(target.quotefn,loopfn(cspec.sel,itersel,inner));target.nodes=[node];setsig(target,fns.length-1)}}}}var target,dsel;for(var sel in directive){if(directive.hasOwnProperty(sel)){dsel=directive[sel];if(typeof(dsel)==='function'||typeof(dsel)==='string'){target=gettarget(dom,sel,false);setsig(target,fns.length);fns[fns.length]=wrapquote(target.quotefn,dataselectfn(dsel))}else{loopgen(dom,sel,dsel,fns)}}}var h=outerHTML(dom),pfns=[];h=h.replace(/<([^>]+)\s(value\=""|selected)\s?([^>]*)>/ig,"<$1 $3>");h=h.split(attPfx).join('');var parts=h.split(Sig),p;for(var i=1;i<parts.length;i++){p=parts[i];pfns[i]=fns[parseInt(p,10)];parts[i]=p.substring(p.indexOf(':')+1)}return concatenator(parts,pfns)}function compile(directive,ctxt,template){var rfn=compiler((template||this[0]).cloneNode(true),directive,ctxt);return function(context){return rfn({context:context})}}function render(ctxt,directive){var fn=typeof directive==='function'?directive:plugins.compile(directive,false,this[0]);for(var i=0,ii=this.length;i<ii;i++){this[i]=replaceWith(this[i],fn(ctxt,false))}context=null;return this}function autoRender(ctxt,directive){var fn=plugins.compile(directive,ctxt,this[0]);for(var i=0,ii=this.length;i<ii;i++){this[i]=replaceWith(this[i],fn(ctxt,false))}context=null;return this}function replaceWith(elm,html){var tagName=elm.tagName,ne,pa,ep,parent={TABLE:{}};if((/TD|TR|TH/).test(tagName)){var parents={TR:{TABLE:'TBODY'},TD:{TABLE:{TBODY:'TR'}},TH:{TABLE:{THEAD:'TR'}}};pa=domify(parents[tagName])}else if((/TBODY|THEAD|TFOOT/).test(tagName)){pa=document.createElement('TABLE')}else{pa=document.createElement('SPAN')}ep=elm.parentNode;ep.insertBefore(pa,elm);ep.removeChild(elm);pa.style.display='none';pa.innerHTML=html;ne=pa.firstChild;ep.insertBefore(ne,pa);ep.removeChild(pa);elm=ne;pa=ne=ep=null;return elm}};$p.plugins={};$p.libs={dojo:function(){if(typeof document.querySelector==='undefined'){$p.plugins.find=function(n,sel){return dojo.query(sel,n)}}},domassistant:function(){if(typeof document.querySelector==='undefined'){$p.plugins.find=function(n,sel){return $(n).cssSelect(sel)}}DOMAssistant.attach({publicMethods:['compile','render','autoRender'],compile:function(directive,ctxt){return $p(this).compile(directive,ctxt)},render:function(ctxt,directive){return $($p(this).render(ctxt,directive))[0]},autoRender:function(ctxt,directive){return $($p(this).autoRender(ctxt,directive))[0]}})},jquery:function(){if(typeof document.querySelector==='undefined'){$p.plugins.find=function(n,sel){return $(n).find(sel)}}jQuery.fn.extend({compile:function(directive,ctxt){return $p(this[0]).compile(directive,ctxt)},render:function(ctxt,directive){return jQuery($p(this[0]).render(ctxt,directive))},autoRender:function(ctxt,directive){return jQuery($p(this[0]).autoRender(ctxt,directive))}})},mootools:function(){if(typeof document.querySelector==='undefined'){$p.plugins.find=function(n,sel){return $(n).getElements(sel)}}Element.implement({compile:function(directive,ctxt){return $p(this).compile(directive,ctxt)},render:function(ctxt,directive){return $p(this).render(ctxt,directive)},autoRender:function(ctxt,directive){return $p(this).autoRender(ctxt,directive)}})},prototype:function(){if(typeof document.querySelector==='undefined'){$p.plugins.find=function(n,sel){n=n===document?n.body:n;return typeof n==='string'?$$(n):$(n).select(sel)}}Element.addMethods({compile:function(element,directive,ctxt){return $p(element).compile(directive,ctxt)},render:function(element,ctxt,directive){return $p(element).render(ctxt,directive)},autoRender:function(element,ctxt,directive){return $p(element).autoRender(ctxt,directive)}})},sizzle:function(){if(typeof document.querySelector==='undefined'){$p.plugins.find=function(n,sel){return Sizzle(sel,n)}}},sly:function(){if(typeof document.querySelector==='undefined'){$p.plugins.find=function(n,sel){return Sly(sel,n)}}}};(function(){var libkey=typeof dojo!=='undefined'&&'dojo'||typeof DOMAssistant!=='undefined'&&'domassistant'||typeof jQuery!=='undefined'&&'jquery'||typeof MooTools!=='undefined'&&'mootools'||typeof Prototype!=='undefined'&&'prototype'||typeof Sizzle!=='undefined'&&'sizzle'||typeof Sly!=='undefined'&&'sly';libkey&&$p.libs[libkey]()})();

tutorial/tuto7.html

 
   <script>
 
-		//example of building a plugin to postprocess the generated HTML
-		
-		$p.plugins.renderWithEffects = function(ctxt, directive, postProcess){
-			var sel, action, elms, 
-			replace_ = function(pobj){
-				return {
-					by:function(pobj2){
-						var i = 0;
-						pobj.length = Math.max(pobj.length, pobj2.length);
-						for(; i<pobj.length; i++){
-							if(typeof pobj2[i] !== 'undefined'){
-								pobj[i] = pobj2[i];
-							}else{
-								delete pobj[i];
-							}
+	//example of building a plugin to postprocess the generated HTML
+	
+	$p.plugins.renderWithEffects = function(ctxt, directive, postProcess){
+		var sel, action, elms, 
+		replace_ = function(pobj){
+			return {
+				by:function(pobj2){
+					var i = 0;
+					pobj.length = Math.max(pobj.length, pobj2.length);
+					for(; i<pobj.length; i++){
+						if(typeof pobj2[i] !== 'undefined'){
+							pobj[i] = pobj2[i];
+						}else{
+							delete pobj[i];
 						}
 					}
 				}
-			};
-			this.render( ctxt, directive );
-			if(typeof postProcess !== 'undefined'){
-				for(sel in postProcess){
-					action = postProcess[sel];
-					if(typeof action === 'function'){
-						replace_( this ).by( this.find(sel) );
-						action.call(this);
-					}
+			}
+		};
+		this.render( ctxt, directive );
+		if(typeof postProcess !== 'undefined'){
+			for(sel in postProcess){
+				action = postProcess[sel];
+				if(typeof action === 'function'){
+					replace_( this ).by( this.find(sel) );
+					action.call(this);
 				}
-			} 
-			return this;
-		};
-		
-		//register it as a jquery extension
-		jQuery.fn.extend({
-			renderWithEffects:function(ctxt, directive, postProcess){ 
-				return jQuery( $p( this[0] ).renderWithEffects( ctxt, directive, postProcess ) ); 
 			}
-		});
+		} 
+		return this;
+	};
+	
+	//register it as a jquery extension
+	jQuery.fn.extend({
+		renderWithEffects:function(ctxt, directive, postProcess){ 
+			return jQuery( $p( this[0] ).renderWithEffects( ctxt, directive, postProcess ) ); 
+		}
+	});
 
 
     var directive = {