aboutsummaryrefslogtreecommitdiffstats
path: root/src/data.js
diff options
context:
space:
mode:
authorJohn Resig <jeresig@gmail.com>2010-09-21 00:44:47 -0400
committerJohn Resig <jeresig@gmail.com>2010-09-21 00:44:47 -0400
commitae9df1412c41b1ae676d3808c323b0f01e0b0600 (patch)
tree30a357f7120a8d5afa3b982133a93cde6d7c7597 /src/data.js
parentd5d4e4df65b56319b4f1216f63008a9751690315 (diff)
downloadjquery-ae9df1412c41b1ae676d3808c323b0f01e0b0600.tar.gz
jquery-ae9df1412c41b1ae676d3808c323b0f01e0b0600.zip
Make sure that undefined is returned for not found data- attributes, not null.
Diffstat (limited to 'src/data.js')
-rw-r--r--src/data.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/data.js b/src/data.js
index cc027158c..dda1683a5 100644
--- a/src/data.js
+++ b/src/data.js
@@ -152,12 +152,15 @@ jQuery.fn.extend({
if ( data === undefined && this[0].nodeType === 1 ) {
data = this[0].getAttribute( "data-" + key );
- if ( data != null ) {
+ if ( typeof data === "string" ) {
data = data === "true" ? true :
data === "false" ? false :
data === "null" ? null :
rnum.test( data ) ? parseFloat( data ) :
data;
+
+ } else {
+ data = undefined;
}
}
}