X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Fjquery%2Fjquery.js;h=7cd07306b7282bf7d65bc77a1b944bbc3a33f999;hb=85afa7c1ba32e2e867b89e4222a4d27ea97dd20d;hp=7c0562aaf5a93bb8074173ad459e530f2a5dd42c;hpb=fc3e180465a88558321b6550ac4692d7cc4b281f;p=jquery.git diff --git a/src/jquery/jquery.js b/src/jquery/jquery.js index 7c0562a..7cd0730 100644 --- a/src/jquery/jquery.js +++ b/src/jquery/jquery.js @@ -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 @@ -1434,7 +1444,7 @@ jQuery.extend({ fn.call( obj[i], i, obj[i] ); else for ( var i = 0, ol = obj.length, val = obj[0]; - i < ol && fn.call(val,i,val) !== false; val = obj[++i] ); + i < ol && fn.call(val,i,val) !== false; val = obj[++i] ){} } return obj; @@ -1857,7 +1867,7 @@ jQuery.extend({ // If a string is passed in for the function, make a function // for it (a handy shortcut) if ( typeof fn == "string" ) - fn = eval("function(a,i){return " + fn + "}"); + fn = eval("false||function(a,i){return " + fn + "}"); var result = []; @@ -1911,7 +1921,7 @@ jQuery.extend({ // If a string is passed in for the function, make a function // for it (a handy shortcut) if ( typeof fn == "string" ) - fn = eval("function(a){return " + fn + "}"); + fn = eval("false||function(a){return " + fn + "}"); var result = []; @@ -2141,7 +2151,8 @@ jQuery.each({ next: "jQuery.nth(a,2,'nextSibling')", prev: "jQuery.nth(a,2,'previousSibling')", siblings: "jQuery.sibling(a.parentNode.firstChild,a)", - children: "jQuery.sibling(a.firstChild)" + children: "jQuery.sibling(a.firstChild)", + contents: "jQuery.nodeName(a,'iframe')?a.contentDocument||a.contentWindow.document:jQuery.makeArray(a.childNodes)" }, function(i,n){ jQuery.fn[ i ] = function(a) { var ret = jQuery.map(this,n); @@ -2227,7 +2238,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; @@ -2422,6 +2434,7 @@ jQuery.each( { * @param String str The string that will be contained within the text of an element. * @cat DOM/Traversing */ +// DEPRECATED jQuery.each( [ "eq", "lt", "gt", "contains" ], function(i,n){ jQuery.fn[ n ] = function(num,fn) { return this.filter( ":" + n + "(" + num + ")", fn );