Commit ae9df141 authored by John Resig's avatar John Resig

Make sure that undefined is returned for not found data- attributes, not null.

parent d5d4e4df
...@@ -152,12 +152,15 @@ jQuery.fn.extend({ ...@@ -152,12 +152,15 @@ jQuery.fn.extend({
if ( data === undefined && this[0].nodeType === 1 ) { if ( data === undefined && this[0].nodeType === 1 ) {
data = this[0].getAttribute( "data-" + key ); data = this[0].getAttribute( "data-" + key );
if ( data != null ) { if ( typeof data === "string" ) {
data = data === "true" ? true : data = data === "true" ? true :
data === "false" ? false : data === "false" ? false :
data === "null" ? null : data === "null" ? null :
rnum.test( data ) ? parseFloat( data ) : rnum.test( data ) ? parseFloat( data ) :
data; data;
} else {
data = undefined;
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment