- before: function() {
- return this.domManip(arguments, false, 1, function(a){
- this.parentNode.insertBefore( a, this );
- });
- },
-
- after: function() {
- return this.domManip(arguments, false, -1, function(a){
- this.parentNode.insertBefore( a, this.nextSibling );
- });
- },
-
- end: function() {
- return this.prevObject || jQuery([]);
- },
-
- find: function(t) {
- var data = jQuery.map(this, function(a){ return jQuery.find(t,a); });
- return this.pushStack( /[^+>] [^+>]/.test( t ) || t.indexOf("..") > -1 ?
- jQuery.unique( data ) : data );
- },
-
- clone: function() {
- var $this = this.add(this.find("*"));
- if (jQuery.browser.msie) {
- // Need to remove events on the element and its descendants
- $this.each(function() {
- this._$events = {};
- for (var type in this.$events)
- this._$events[type] = jQuery.extend({},this.$events[type]);
- }).unbind();
- }
-
- // Do the clone
- var r = this.pushStack( jQuery.map( this, function(a){
- return a.cloneNode( true );
- }) );
-
- if (jQuery.browser.msie) {
- $this.each(function() {
- // Add the events back to the original and its descendants
- var events = this._$events;
- for (var type in events)
- for (var handler in events[type])
- jQuery.event.add(this, type, events[type][handler], events[type][handler].data);
- this._$events = null;
- });
- }
-
- // copy form values over
- var inputs = r.add(r.find('*')).filter('select,input[@type=checkbox]');
- $this.filter('select,input[@type=checkbox]').each(function(i) {
- if (this.selectedIndex)
- inputs[i].selectedIndex = this.selectedIndex;
- if (this.checked)
- inputs[i].checked = true;
- });
-
- // Return the cloned set
- return r;
- },
-
- filter: function(t) {
- return this.pushStack(
- jQuery.isFunction( t ) &&
- jQuery.grep(this, function(el, index){
- return t.apply(el, [index]);
- }) ||
-
- jQuery.multiFilter(t,this) );
- },
-
- not: function(t) {
- return this.pushStack(
- t.constructor == String &&
- jQuery.multiFilter(t, this, true) ||
-
- jQuery.grep(this, function(a) {
- return ( t.constructor == Array || t.jquery )
- ? jQuery.inArray( a, t ) < 0
- : a != t;
- })
- );
- },
-
- add: function(t) {
- return this.pushStack( jQuery.merge(
- this.get(),
- t.constructor == String ?
- jQuery(t).get() :
- t.length != undefined && (!t.nodeName || t.nodeName == "FORM") ?
- t : [t] )
- );
- },
+ ready: function( fn ) {
+ // Attach the listeners
+ jQuery.bindReady();
+
+ // If the DOM is already ready
+ if ( jQuery.isReady ) {
+ // Execute the function immediately
+ fn.call( document, jQuery );
+
+ // Otherwise, remember the function for later
+ } else if ( readyList ) {
+ // Add the function to the wait list
+ readyList.push( fn );
+ }