X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=jquery%2Fjquery.js;h=b8a8b4a3379d0f2e671d9b07fb9025f009950f2d;hb=193866de0aabe1a86d9cd2c4ff147f5dda626872;hp=6b1d2f1cb1f2220f733479a8b4ef5b56ca78a5b0;hpb=6b6773fe39bfa9ebf8fbd06aeac056a571c29416;p=jquery.git diff --git a/jquery/jquery.js b/jquery/jquery.js index 6b1d2f1..b8a8b4a 100644 --- a/jquery/jquery.js +++ b/jquery/jquery.js @@ -1,7 +1,10 @@ /* - * JQuery (http://jquery.com/) + * jQuery (http://jquery.com/) * By John Resig (http://ejohn.org/) * Under an Attribution, Share Alike License + * + * $Date$ + * $Rev$ */ function $(a,c) { @@ -32,7 +35,7 @@ function $(a,c) { // Load Dynamic Function List var self = { cur: $.Select($a,$c), - $jquery: "0.30", + $jquery: "$Rev$", // The only two getters size: function() {return this.get().length}, @@ -209,21 +212,27 @@ function $(a,c) { this.cur = this.old; return this; }, - - parent: function(a) { - if ( a == null ) a = 1; - this.cur = $.map(this.cur,function(d){ - var b = $.parents(d); - if ( a == 0 ) - return b; - else if ( a.constructor == String ) { - var c = $.filter(a,b); - return c.length > 0 ? c[0] : null; - } else - return b.length >= a ? b[a-1] : null; - }); - return this; - }, + + parent: function(a) { + this.cur = $.map(this.cur,function(d){ + return d.parentNode; + }); + if ( a ) this.cur = $.filter(a,this.cur).r; + return this; + }, + + parents: function(a) { + this.cur = $.map(this.cur,$.parents); + if ( a ) this.cur = $.filter(a,this.cur).r; + return this; + }, + + siblings: function(a) { + // Incorrect, need to exclude current element + this.cur = $.map(this.cur,$.sibling); + if ( a ) this.cur = $.filter(a,this.cur).r; + return this; + }, parents: function(a) { return this; @@ -570,7 +579,7 @@ $.filter = function(t,r,not) { $.parents = function(a){ var b = []; var c = a.parentNode; - while ( c != null && c != c.documentElement ) { + while ( c != null && c != document ) { b[b.length] = c; c = c.parentNode; }