Added $(...).map() functionality. (Also closes #1250, imo)
[jquery.git] / src / jquery / jquery.js
index 4c5941b..8180a4e 100644 (file)
@@ -1182,9 +1182,19 @@ jQuery.fn = jQuery.prototype = {
                        this.empty().append( val );
        },
 
+       replaceWith: function( val ) {
+               return this.after( val ).remove();
+       },
+
        slice: function() {
                return this.pushStack( Array.prototype.slice.apply( this, arguments ) );
        },
+
+       map: function(fn){
+               return this.pushStack(jQuery.map( this, function(elem,i){
+                       return fn.call( elem, i, elem );
+               }));
+       },
        
        /**
         * @private
@@ -2227,7 +2237,8 @@ jQuery.each({
        appendTo: "append",
        prependTo: "prepend",
        insertBefore: "before",
-       insertAfter: "after"
+       insertAfter: "after",
+       replaceAll: "replaceWith"
 }, function(i,n){
        jQuery.fn[ i ] = function(){
                var a = arguments;