- };
-
- // TODO: Remove need to return this
- for ( var i in $.fn ) {
- if ( self[i] !== null )
- self["_"+i] = self[i];
- self[i] = $.fn[i];
- }
-
- if ( typeof Prototype != "undefined" && $a.constructor != String ) {
- if ( $c ) $a = self.get();
- for ( var k in self ) {(function(j){
- try {
- if ( !$a[j] )
- $a[j] = function() {
- return $.apply(self,self[j],arguments);
- };
- } catch(e) {}
- })(k);}
- return $a;
- }
-
- return self;
-}
-
-(function(){
- var b = navigator.userAgent.toLowerCase();
-
- // Figure out what browser is being used
- $.browser =
- ( /webkit/.test(b) && "safari" ) ||
- ( /opera/.test(b) && "opera" ) ||
- ( /msie/.test(b) && "msie" ) ||
- ( !/compatible/.test(b) && "mozilla" ) ||
- "other";
-
- // Check to see if the W3C box model is being used
- $.boxModel = ( $.browser != "msie" ||
- document.compatMode == "CSS1Compat" );
-})();
-
-$.apply = function(o,f,a) {
- a = a || [];
- if ( f.apply )
- return f.apply( o, a );
- else {
- var p = [];
- for (var i = 0; i < a.length; i++)
- p[i] = 'a['+i+']';
- o.$$exec = this;
- var r = eval('o.$$exec(' + p.join(',') + ')');
- o.$$exec = null;
- return r;
- }
-};
-
-$.getCSS = function(e,p) {
- // Adapted from Prototype 1.4.0
- if ( p == 'height' || p == 'width' ) {
-
- // Handle extra width/height provided by the W3C box model
- var ph = (!$.boxModel ? 0 :
- parseInt($.css(e,"paddingTop")) + parseInt($.css(e,"paddingBottom")) +
- parseInt($.css(e,"borderTopWidth")) + parseInt($.css(e,"borderBottomWidth"))) || 0;
-
- var pw = (!$.boxModel ? 0 :
- parseInt($.css(e,"paddingLeft")) + parseInt($.css(e,"paddingRight")) +
- parseInt($.css(e,"borderLeftWidth")) + parseInt($.css(e,"borderRightWidth"))) || 0;
-
- var oHeight, oWidth;
+ return t;
+ },
+
+ /**
+ * Wrap all matched elements with a structure of other elements.
+ * This wrapping process is most useful for injecting additional
+ * stucture into a document, without ruining the original semantic
+ * qualities of a document.
+ *
+ * The way that is works is that it goes through the first element argument
+ * provided and finds the deepest element within the structure - it is that
+ * element that will en-wrap everything else.
+ *
+ * @example $("p").wrap("<div class='wrap'></div>");
+ * @before <p>Test Paragraph.</p>
+ * @result <div class='wrap'><p>Test Paragraph.</p></div>
+ *
+ * @name wrap
+ * @type jQuery
+ * @any String html A string of HTML, that will be created on the fly and wrapped around the target.
+ * @any Element elem A DOM element that will be wrapped.
+ * @any Array<Element> elems An array of elements, the first of which will be wrapped.
+ * @any Object obj Any object, converted to a string, then a text node.
+ */
+ wrap: function() {
+ // The elements to wrap the target around
+ var a = jQuery.clean(arguments);
+
+ // Wrap each of the matched elements individually
+ return this.each(function(){
+ // Clone the structure that we're using to wrap
+ var b = a[0].cloneNode(true);
+
+ // Insert it before the element to be wrapped
+ this.parentNode.insertBefore( b, this );
+
+ // Find he deepest point in the wrap structure
+ while ( b.firstChild )
+ b = b.firstChild;
+
+ // Move the matched element to within the wrap structure
+ b.appendChild( this );
+ });
+ },
+
+ /**
+ * Append any number of elements to the inside of all matched elements.
+ * This operation is similar to doing an <tt>appendChild</tt> to all the
+ * specified elements, adding them into the document.
+ *
+ * @example $("p").append("<b>Hello</b>");
+ * @before <p>I would like to say: </p>
+ * @result <p>I would like to say: <b>Hello</b></p>
+ *
+ * @name append
+ * @type jQuery
+ * @any String html A string of HTML, that will be created on the fly and appended to the target.
+ * @any Element elem A DOM element that will be appended.
+ * @any Array<Element> elems An array of elements, all of which will be appended.
+ * @any Object obj Any object, converted to a string, then a text node.
+ */
+ append: function() {
+ return this.domManip(arguments, true, 1, function(a){
+ this.appendChild( a );
+ });
+ },
+
+ /**
+ * Prepend any number of elements to the inside of all matched elements.
+ * This operation is the best way to insert a set of elements inside, at the
+ * beginning, of all the matched element.
+ *
+ * @example $("p").prepend("<b>Hello</b>");
+ * @before <p>, how are you?</p>
+ * @result <p><b>Hello</b>, how are you?</p>
+ *
+ * @name prepend
+ * @type jQuery
+ * @any String html A string of HTML, that will be created on the fly and prepended to the target.
+ * @any Element elem A DOM element that will be prepended.
+ * @any Array<Element> elems An array of elements, all of which will be prepended.
+ * @any Object obj Any object, converted to a string, then a text node.
+ */
+ prepend: function() {
+ return this.domManip(arguments, true, -1, function(a){
+ this.insertBefore( a, this.firstChild );
+ });
+ },
+
+ /**
+ * Insert any number of elements before each of the matched elements.
+ *
+ * @example $("p").before("<b>Hello</b>");
+ * @before <p>how are you?</p>
+ * @result <b>Hello</b><p>how are you?</p>
+ *
+ * @name before
+ * @type jQuery
+ * @any String html A string of HTML, that will be created on the fly and inserted.
+ * @any Element elem A DOM element that will beinserted.
+ * @any Array<Element> elems An array of elements, all of which will be inserted.
+ * @any Object obj Any object, converted to a string, then a text node.
+ */
+ before: function() {
+ return this.domManip(arguments, false, 1, function(a){
+ this.parentNode.insertBefore( a, this );
+ });
+ },
+
+ /**
+ * Insert any number of elements after each of the matched elements.
+ *
+ * @example $("p").after("<p>I'm doing fine.</p>");
+ * @before <p>How are you?</p>
+ * @result <p>How are you?</p><p>I'm doing fine.</p>
+ *
+ * @name after
+ * @type jQuery
+ * @any String html A string of HTML, that will be created on the fly and inserted.
+ * @any Element elem A DOM element that will beinserted.
+ * @any Array<Element> elems An array of elements, all of which will be inserted.
+ * @any Object obj Any object, converted to a string, then a text node.
+ */
+ after: function() {
+ return this.domManip(arguments, false, -1, function(a){
+ this.parentNode.insertBefore( a, this.nextSibling );
+ });
+ },
+
+ /**
+ * End the most recent 'destructive' operation, reverting the list of matched elements
+ * back to its previous state. After an end operation, the list of matched elements will
+ * revert to the last state of matched elements.
+ *
+ * @example $("p").find("span").end();
+ * @before <p><span>Hello</span>, how are you?</p>
+ * @result $("p").find("span").end() == [ <p>...</p> ]
+ *
+ * @name end
+ * @type jQuery
+ */
+ end: function() {
+ return this.get( this.stack.pop() );
+ },
+
+ /**
+ * Searches for all elements that match the specified expression.
+ * This method is the optimal way of finding additional descendant
+ * elements with which to process.
+ *
+ * All searching is done using a jQuery expression. The expression can be
+ * written using CSS 1-3 Selector syntax, or basic XPath.
+ *
+ * @example $("p").find("span");
+ * @before <p><span>Hello</span>, how are you?</p>
+ * @result $("p").find("span") == [ <span>Hello</span> ]
+ *
+ * @name find
+ * @type jQuery
+ * @param String expr An expression to search with.
+ */
+ find: function(t) {
+ return this.pushStack( jQuery.map( this, function(a){
+ return jQuery.find(t,a);
+ }), arguments );
+ },
+
+ /**
+ * Removes all elements from the set of matched elements that do not
+ * match the specified expression. This method is used to narrow down
+ * the results of a search.
+ *
+ * All searching is done using a jQuery expression. The expression
+ * can be written using CSS 1-3 Selector syntax, or basic XPath.
+ *
+ * @example $("p").filter(".selected")
+ * @before <p class="selected">Hello</p><p>How are you?</p>
+ * @result $("p").filter(".selected") == [ <p class="selected">Hello</p> ]
+ *
+ * @name filter
+ * @type jQuery
+ * @param String expr An expression to search with.
+ */
+
+ /**
+ * Removes all elements from the set of matched elements that do not
+ * match at least one of the expressions passed to the function. This
+ * method is used when you want to filter the set of matched elements
+ * through more than one expression.
+ *
+ * Elements will be retained in the jQuery object if they match at
+ * least one of the expressions passed.
+ *
+ * @example $("p").filter([".selected", ":first"])
+ * @before <p>Hello</p><p>Hello Again</p><p class="selected">And Again</p>
+ * @result $("p").filter([".selected", ":first"]) == [ <p>Hello</p>, <p class="selected">And Again</p> ]
+ *
+ * @name filter
+ * @type jQuery
+ * @param Array<String> exprs A set of expressions to evaluate against
+ */
+ filter: function(t) {
+ return this.pushStack(
+ t.constructor == Array &&
+ jQuery.map(this,function(a){
+ for ( var i = 0; i < t.length; i++ )
+ if ( jQuery.filter(t[i],[a]).r.length )
+ return a;
+ }) ||
+
+ t.constructor == Boolean &&
+ ( t ? this.get() : [] ) ||
+
+ t.constructor == Function &&
+ jQuery.grep( this, t ) ||
+
+ jQuery.filter(t,this).r, arguments );
+ },
+
+ /**
+ * Removes the specified Element from the set of matched elements. This
+ * method is used to remove a single Element from a jQuery object.
+ *
+ * @example $("p").not( document.getElementById("selected") )
+ * @before <p>Hello</p><p id="selected">Hello Again</p>
+ * @result [ <p>Hello</p> ]
+ *
+ * @name not
+ * @type jQuery
+ * @param Element el An element to remove from the set
+ */
+
+ /**
+ * Removes elements matching the specified expression from the set
+ * of matched elements. This method is used to remove one or more
+ * elements from a jQuery object.
+ *
+ * @example $("p").not("#selected")
+ * @before <p>Hello</p><p id="selected">Hello Again</p>
+ * @result [ <p>Hello</p> ]
+ *
+ * @name not
+ * @type jQuery
+ * @param String expr An expression with which to remove matching elements
+ */
+ not: function(t) {
+ return this.pushStack( t.constructor == String ?
+ jQuery.filter(t,this,false).r :
+ jQuery.grep(this,function(a){ return a != t; }), arguments );
+ },