aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorjeresig <jeresig@gmail.com>2010-09-27 11:51:01 -0400
committerjeresig <jeresig@gmail.com>2010-09-27 11:51:01 -0400
commit0be7f4eb4f027dce00f11d7816290022d447d336 (patch)
treeb4347a748f59041f9ebf1311a6e0f4ec1db7bb44 /src
parent0da700a4d03c1c43e75e3ab7f8e719e13c7e444a (diff)
downloadjquery-0be7f4eb4f027dce00f11d7816290022d447d336.tar.gz
jquery-0be7f4eb4f027dce00f11d7816290022d447d336.zip
Make sure that opacity is being reset properly on a show animation. Additionally expose jQuery.isNaN from the data module.
Diffstat (limited to 'src')
-rw-r--r--src/core.js7
-rw-r--r--src/css.js22
-rw-r--r--src/data.js5
3 files changed, 22 insertions, 12 deletions
diff --git a/src/core.js b/src/core.js
index cc921385d..3389e83f7 100644
--- a/src/core.js
+++ b/src/core.js
@@ -33,6 +33,9 @@ var jQuery = function( selector, context ) {
// Check for non-word characters
rnonword = /\W/,
+ // Check for digits
+ rdigit = /\d/,
+
// Match a standalone tag
rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/,
@@ -488,6 +491,10 @@ jQuery.extend({
return obj && typeof obj === "object" && "setInterval" in obj;
},
+ isNaN: function( obj ) {
+ return obj == null || !rdigit.test( obj ) || isNaN( obj );
+ },
+
type: function( obj ) {
return obj == null ?
String( obj ) :
diff --git a/src/css.js b/src/css.js
index 77949aebc..07ff686d0 100644
--- a/src/css.js
+++ b/src/css.js
@@ -32,10 +32,15 @@ jQuery.extend({
// behavior of getting and setting a style property
cssHooks: {
opacity: {
- get: function( elem ) {
- // We should always get a number back from opacity
- var ret = curCSS( elem, "opacity", "opacity" );
- return ret === "" ? "1" : ret;
+ get: function( elem, computed ) {
+ if ( computed ) {
+ // We should always get a number back from opacity
+ var ret = curCSS( elem, "opacity", "opacity" );
+ return ret === "" ? "1" : ret;
+
+ } else {
+ return elem.style.opacity;
+ }
}
}
},
@@ -176,7 +181,7 @@ if ( !jQuery.support.opacity ) {
// IE uses filters for opacity
return ropacity.test((computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "") ?
(parseFloat(RegExp.$1) / 100) + "" :
- "1";
+ computed ? "1" : "";
},
set: function( elem, value ) {
@@ -187,11 +192,10 @@ if ( !jQuery.support.opacity ) {
style.zoom = 1;
// Set the alpha filter to set the opacity
- var opacity = isNaN(value) ?
+ var opacity = jQuery.isNaN(value) ?
"" :
- "alpha(opacity=" + value * 100 + ")";
-
- var filter = style.filter || elem.currentStyle && elem.currentStyle.filter || "";
+ "alpha(opacity=" + value * 100 + ")",
+ filter = style.filter || "";
style.filter = ralpha.test(filter) ?
filter.replace(ralpha, opacity) :
diff --git a/src/data.js b/src/data.js
index 448e24393..43ab5955c 100644
--- a/src/data.js
+++ b/src/data.js
@@ -1,8 +1,7 @@
(function( jQuery ) {
var windowData = {},
- rbrace = /^(?:\{.*\}|\[.*\])$/,
- rdigit = /\d/;
+ rbrace = /^(?:\{.*\}|\[.*\])$/;
jQuery.extend({
cache: {},
@@ -174,7 +173,7 @@ jQuery.fn.extend({
data = data === "true" ? true :
data === "false" ? false :
data === "null" ? null :
- rdigit.test( data ) && !isNaN( data ) ? parseFloat( data ) :
+ !jQuery.isNaN( data ) ? parseFloat( data ) :
rbrace.test( data ) ? jQuery.parseJSON( data ) :
data;
} catch( e ) {}