- $.boxModel = ( $.browser != "msie" || document.compatMode == "CSS1Compat" );
-})();
-
-$.css = 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 :
- $.css(e,"paddingTop") + $.css(e,"paddingBottom") +
- $.css(e,"borderTopWidth") + $.css(e,"borderBottomWidth")) || 0;
-
- var pw = (!$.boxModel ? 0 :
- $.css(e,"paddingLeft") + $.css(e,"paddingRight") +
- $.css(e,"borderLeftWidth") + $.css(e,"borderRightWidth")) || 0;
-
- var oHeight, oWidth;
-
- if ($.css(e,"display") != 'none') {
- oHeight = e.offsetHeight || parseInt(e.style.height) || 0;
- oWidth = e.offsetWidth || parseInt(e.style.width) || 0;
- } else {
- var els = e.style;
- var ov = els.visibility;
- var op = els.position;
- var od = els.display;
- els.visibility = "hidden";
- els.position = "absolute";
- els.display = "";
- oHeight = e.clientHeight || parseInt(e.style.height);
- oWidth = e.clientWidth || parseInt(e.style.width);
- els.display = od;
- els.position = op;
- els.visibility = ov;
- }
-
- return p == "height" ?
- (oHeight - ph < 0 ? 0 : oHeight - ph) :
- (oWidth - pw < 0 ? 0 : oWidth - pw);
+ jQuery.boxModel = !jQuery.browser.msie || document.compatMode == "CSS1Compat";
+
+ var axis = {
+ /**
+ * Get a set of elements containing the unique parents of the matched
+ * set of elements.
+ *
+ * @example $("p").parent()
+ * @before <div><p>Hello</p><p>Hello</p></div>
+ * @result [ <div><p>Hello</p><p>Hello</p></div> ]
+ *
+ * @name parent
+ * @type jQuery
+ */
+
+ /**
+ * Get a set of elements containing the unique parents of the matched
+ * set of elements, and filtered by an expression.
+ *
+ * @example $("p").parent(".selected")
+ * @before <div><p>Hello</p></div><div class="selected"><p>Hello Again</p></div>
+ * @result [ <div class="selected"><p>Hello Again</p></div> ]
+ *
+ * @name parent
+ * @type jQuery
+ * @param String expr An expression to filter the parents with
+ */
+ parent: "a.parentNode",
+
+ /**
+ * Get a set of elements containing the unique ancestors of the matched
+ * set of elements.
+ *
+ * @example $("span").ancestors()
+ * @before <html><body><div><p><span>Hello</span></p><span>Hello Again</span></div></body></html>
+ * @result [ <body>...</body>, <div>...</div>, <p><span>Hello</span></p> ]
+ *
+ * @name ancestors
+ * @type jQuery
+ */
+
+ /**
+ * Get a set of elements containing the unique ancestors of the matched
+ * set of elements, and filtered by an expression.
+ *
+ * @example $("span").ancestors("p")
+ * @before <html><body><div><p><span>Hello</span></p><span>Hello Again</span></div></body></html>
+ * @result [ <p><span>Hello</span></p> ]
+ *
+ * @name ancestors
+ * @type jQuery
+ * @param String expr An expression to filter the ancestors with
+ */
+ ancestors: jQuery.parents,
+
+ /**
+ * A synonym for ancestors
+ */
+ parents: jQuery.parents,
+
+ /**
+ * Get a set of elements containing the unique next siblings of each of the
+ * matched set of elements.
+ *
+ * It only returns the very next sibling, not all next siblings.
+ *
+ * @example $("p").next()
+ * @before <p>Hello</p><p>Hello Again</p><div><span>And Again</span></div>
+ * @result [ <p>Hello Again</p>, <div><span>And Again</span></div> ]
+ *
+ * @name next
+ * @type jQuery
+ */
+
+ /**
+ * Get a set of elements containing the unique next siblings of each of the
+ * matched set of elements, and filtered by an expression.
+ *
+ * It only returns the very next sibling, not all next siblings.
+ *
+ * @example $("p").next(".selected")
+ * @before <p>Hello</p><p class="selected">Hello Again</p><div><span>And Again</span></div>
+ * @result [ <p class="selected">Hello Again</p> ]
+ *
+ * @name next
+ * @type jQuery
+ * @param String expr An expression to filter the next Elements with
+ */
+ next: "a.nextSibling",
+
+ /**
+ * Get a set of elements containing the unique previous siblings of each of the
+ * matched set of elements.
+ *
+ * It only returns the immediately previous sibling, not all previous siblings.
+ *
+ * @example $("p").previous()
+ * @before <p>Hello</p><div><span>Hello Again</span></div><p>And Again</p>
+ * @result [ <div><span>Hello Again</span></div> ]
+ *
+ * @name prev
+ * @type jQuery
+ */
+
+ /**
+ * Get a set of elements containing the unique previous siblings of each of the
+ * matched set of elements, and filtered by an expression.
+ *
+ * It only returns the immediately previous sibling, not all previous siblings.
+ *
+ * @example $("p").previous("selected")
+ * @before <div><span>Hello</span></div><p class="selected">Hello Again</p><p>And Again</p>
+ * @result [ <div><span>Hello</span></div> ]
+ *
+ * @name prev
+ * @type jQuery
+ * @param String expr An expression to filter the previous Elements with
+ */
+ prev: "a.previousSibling",
+
+ /**
+ * Get a set of elements containing all of the unique siblings of each of the
+ * matched set of elements.
+ *
+ * @example $("div").siblings()
+ * @before <p>Hello</p><div><span>Hello Again</span></div><p>And Again</p>
+ * @result [ <p>Hello</p>, <p>And Again</p> ]
+ *
+ * @name siblings
+ * @type jQuery
+ */
+
+ /**
+ * Get a set of elements containing all of the unique siblings of each of the
+ * matched set of elements, and filtered by an expression.
+ *
+ * @example $("div").siblings("selected")
+ * @before <div><span>Hello</span></div><p class="selected">Hello Again</p><p>And Again</p>
+ * @result [ <p class="selected">Hello Again</p> ]
+ *
+ * @name siblings
+ * @type jQuery
+ * @param String expr An expression to filter the sibling Elements with
+ */
+ siblings: jQuery.sibling
+ };
+
+ for ( var i in axis ) new function(){
+ var t = axis[i];
+ jQuery.fn[ i ] = function(a) {
+ var ret = jQuery.map(this,t);
+ if ( a ) ret = jQuery.filter(a,ret).r;
+ return this.pushStack( ret, arguments );
+ };