aboutsummaryrefslogtreecommitdiffstats
path: root/src/css.js
diff options
context:
space:
mode:
authorjeresig <jeresig@gmail.com>2010-10-09 10:52:53 -0400
committerjeresig <jeresig@gmail.com>2010-10-09 10:52:53 -0400
commit2ae872c594790c4b935a1d7eabdf8b8212fd3c3f (patch)
tree14916eb14437028b5261acc7efbe8b9b84a2423a /src/css.js
parent2ca36598954759c5b5dce569a39c52b981ed4ab2 (diff)
downloadjquery-2ae872c594790c4b935a1d7eabdf8b8212fd3c3f.tar.gz
jquery-2ae872c594790c4b935a1d7eabdf8b8212fd3c3f.zip
Make sure null/NaN values aren't set in .css(). Fixes #7116.
Diffstat (limited to 'src/css.js')
-rw-r--r--src/css.js7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/css.js b/src/css.js
index 99cb73581..caf4985d2 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";