| 310 | }); |
| 311 | |
| 312 | function dataAttr( elem, key, data ) { |
| 313 | // If nothing was found internally, try to fetch any |
| 314 | // data from the HTML5 data-* attribute |
| 315 | if ( data === undefined && elem.nodeType === 1 ) { |
| 316 | |
| 317 | var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); |
| 318 | |
| 319 | data = elem.getAttribute( name ); |
| 320 | |
| 321 | if ( typeof data === "string" ) { |
| 322 | try { |
| 323 | data = data === "true" ? true : |
| 324 | data === "false" ? false : |
| 325 | data === "null" ? null : |
| 326 | jQuery.isNumeric( data ) ? parseFloat( data ) : |
| 327 | rbrace.test( data ) ? jQuery.parseJSON( data ) : |
| 328 | data; |
| 329 | } catch( e ) {} |
| 330 | |
| 331 | // Make sure we set the data so it isn't changed later |
| 332 | jQuery.data( elem, key, data ); |
| 333 | |
| 334 | } else { |
| 335 | data = undefined; |
| 336 | } |
| 337 | } |
| 338 | |
| 339 | return data; |
| 340 | } |
| 341 | |
| 342 | // checks a cache object for emptiness |
| 343 | function isEmptyDataObject( obj ) { |