return num == undefined ?
// Return a 'clean' array
- jQuery.map( this, function(a){ return a } ) :
+ jQuery.merge( this, [] ) :
// Return just the object
this[num];
}), arguments );
},
+ /**
+ * Create cloned copies of all matched DOM Elements. This does
+ * not create a cloned copy of this particular jQuery object,
+ * instead it creates duplicate copies of all DOM Elements.
+ * This is useful for moving copies of the elements to another
+ * location in the DOM.
+ *
+ * @example $("b").clone().prependTo("p");
+ * @before <b>Hello</b><p>, how are you?</p>
+ * @result <b>Hello</b><p><b>Hello</b>, how are you?</p>
+ *
+ * @name clone
+ * @type jQuery
+ * @cat DOM/Manipulation
+ */
clone: function(deep) {
return this.pushStack( jQuery.map( this, function(a){
return a.cloneNode( deep != undefined ? deep : true );
oWidth = e.offsetWidth;
} else {
e = jQuery(e.cloneNode(true)).css({
- visibility: "hidden", position: "absolute", display: "block"
+ visibility: "hidden", position: "absolute", display: "block", right: "0", left: "0"
}).appendTo(e.parentNode)[0];
+ var parPos = jQuery.css(e.parentNode,"position");
+ if ( parPos == "" || parPos == "static" )
+ e.parentNode.style.position = "relative";
+
oHeight = e.clientHeight;
oWidth = e.clientWidth;
+ if ( parPos == "" || parPos == "static" )
+ e.parentNode.style.position = "static";
+
e.parentNode.removeChild(e);
}
});
} else if (elem.currentStyle) {
- var newProp = prop.replace(/\-(\w)/g,function(m,c){return c.toUpperCase()});
+ var newProp = prop.replace(/\-(\w)/g,function(m,c){return c.toUpperCase();});
ret = elem.currentStyle[prop] || elem.currentStyle[newProp];
} else if (document.defaultView && document.defaultView.getComputedStyle) {
innerHTML: "innerHTML",
className: "className",
value: "value",
- disabled: "disabled"
+ disabled: "disabled",
+ checked: "checked"
};
if ( fix[name] ) {
* Get the current CSS background of the first matched element.
*
* @example $("p").background();
- * @before <p>This is just a test.</p>
- * @result ""
+ * @before <p style="background:blue;">This is just a test.</p>
+ * @result "blue"
*
* @name background
* @type String
*/
css: "width,height,top,left,position,float,overflow,color,background".split(","),
+
+ /**
+ * Reduce the set of matched elements to a single element.
+ * The position of the element in the set of matched elements
+ * starts at 0 and goes to length - 1.
+ *
+ * @example $("p").eq(1)
+ * @before <p>This is just a test.</p><p>So is this</p>
+ * @result [ <p>So is this</p> ]
+ *
+ * @name eq
+ * @type jQuery
+ * @param Number pos The index of the element that you wish to limit to.
+ * @cat Core
+ */
+
+ /**
+ * Reduce the set of matched elements to all elements before a given position.
+ * The position of the element in the set of matched elements
+ * starts at 0 and goes to length - 1.
+ *
+ * @example $("p").lt(1)
+ * @before <p>This is just a test.</p><p>So is this</p>
+ * @result [ <p>This is just a test.</p> ]
+ *
+ * @name lt
+ * @type jQuery
+ * @param Number pos Reduce the set to all elements below this position.
+ * @cat Core
+ */
+
+ /**
+ * Reduce the set of matched elements to all elements after a given position.
+ * The position of the element in the set of matched elements
+ * starts at 0 and goes to length - 1.
+ *
+ * @example $("p").gt(0)
+ * @before <p>This is just a test.</p><p>So is this</p>
+ * @result [ <p>So is this</p> ]
+ *
+ * @name gt
+ * @type jQuery
+ * @param Number pos Reduce the set to all elements after this position.
+ * @cat Core
+ */
+
+ /**
+ * Filter the set of elements to those that contain the specified text.
+ *
+ * @example $("p").contains("test")
+ * @before <p>This is just a test.</p><p>So is this</p>
+ * @result [ <p>This is just a test.</p> ]
+ *
+ * @name contains
+ * @type jQuery
+ * @param String str The string that will be contained within the text of an element.
+ * @cat DOM/Traversing
+ */
filter: [ "eq", "lt", "gt", "contains" ],
each: {
+ /**
+ * Remove an attribute from each of the matched elements.
+ *
+ * @example $("input").removeAttr("disabled")
+ * @before <input disabled="disabled"/>
+ * @result <input/>
+ *
+ * @name removeAttr
+ * @type jQuery
+ * @param String name The name of the attribute to remove.
+ * @cat DOM
+ */
removeAttr: function( key ) {
this.removeAttribute( key );
},