( elem, key, data )
| 291 | }); |
| 292 | |
| 293 | function dataAttr( elem, key, data ) { |
| 294 | // If nothing was found internally, try to fetch any |
| 295 | // data from the HTML5 data-* attribute |
| 296 | if ( data === undefined && elem.nodeType === 1 ) { |
| 297 | |
| 298 | var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); |
| 299 | |
| 300 | data = elem.getAttribute( name ); |
| 301 | |
| 302 | if ( typeof data === "string" ) { |
| 303 | try { |
| 304 | data = data === "true" ? true : |
| 305 | data === "false" ? false : |
| 306 | data === "null" ? null : |
| 307 | // Only convert to a number if it doesn't change the string |
| 308 | +data + "" === data ? +data : |
| 309 | rbrace.test( data ) ? jQuery.parseJSON( data ) : |
| 310 | data; |
| 311 | } catch( e ) {} |
| 312 | |
| 313 | // Make sure we set the data so it isn't changed later |
| 314 | jQuery.data( elem, key, data ); |
| 315 | |
| 316 | } else { |
| 317 | data = undefined; |
| 318 | } |
| 319 | } |
| 320 | |
| 321 | return data; |
| 322 | } |
| 323 | |
| 324 | // checks a cache object for emptiness |
| 325 | function isEmptyDataObject( obj ) { |
no test coverage detected
searching dependent graphs…