diff options
author | John Resig <jeresig@gmail.com> | 2006-08-09 05:44:25 +0000 |
---|---|---|
committer | John Resig <jeresig@gmail.com> | 2006-08-09 05:44:25 +0000 |
commit | 6a50758086f2db26b12b12e8c58a42cbbd28a98a (patch) | |
tree | a587a2bc21ffc1ba2c11ee93d7d0560d8010fe06 | |
parent | f2d4bffcc760eb03dae13a9d9e7f0bbd8ec33c1e (diff) | |
download | jquery-6a50758086f2db26b12b12e8c58a42cbbd28a98a.tar.gz jquery-6a50758086f2db26b12b12e8c58a42cbbd28a98a.zip |
Fixed some bugs with attribute handling.
-rw-r--r-- | jquery/jquery.js | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/jquery/jquery.js b/jquery/jquery.js index 50bbde331..ebf103865 100644 --- a/jquery/jquery.js +++ b/jquery/jquery.js @@ -241,7 +241,7 @@ jQuery.fn = jQuery.prototype = { */ attr: function( key, value, type ) { // Check to see if we're setting style values - return key.constructor != String || value ? + return key.constructor != String || value != undefined ? this.each(function(){ // See if we're setting a hash of styles if ( value == undefined ) @@ -759,6 +759,12 @@ jQuery.extend({ return this.each( n, arguments ); }; }); + + jQuery.each( jQuery.macros.filter, function(i,n){ + jQuery.fn[ n ] = function(num,fn) { + return this.filter( ":" + n + "(" + num + ")", fn ); + }; + }); jQuery.each( jQuery.macros.attr, function(i,n){ n = n || i; @@ -1739,6 +1745,8 @@ jQuery.macros = { css: "width,height,top,left,position,float,overflow,color,background".split(","), + filter: [ "eq", "lt", "gt", "contains" ], + attr: { /** * Get the current value of the first matched element. |