X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Fcss.js;h=caf4985d2f5811f970bb4b19c41d01589b4e9a7b;hb=2ae872c594790c4b935a1d7eabdf8b8212fd3c3f;hp=99cb73581cd4430aeeb8bd2696b364514e0f849d;hpb=2ca36598954759c5b5dce569a39c52b981ed4ab2;p=jquery.git diff --git a/src/css.js b/src/css.js index 99cb735..caf4985 100644 --- a/src/css.js +++ b/src/css.js @@ -70,7 +70,7 @@ jQuery.extend({ style: function( elem, name, value, extra ) { // Don't set styles on text and comment nodes if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { - return undefined; + return; } // Make sure that we're working with the right name @@ -81,6 +81,11 @@ jQuery.extend({ // Check if we're setting a value if ( value !== undefined ) { + // Make sure that NaN and null values aren't set. See: #7116 + if ( typeof value === "number" && isNaN( value ) || value == null ) { + return; + } + // If a number was passed in, add 'px' to the (except for certain CSS properties) if ( typeof value === "number" && !jQuery.cssNumber[ origName ] ) { value += "px";