( elem, key, data )
| 2698 | }); |
| 2699 | |
| 2700 | function dataAttr( elem, key, data ) { |
| 2701 | // If nothing was found internally, try to fetch any |
| 2702 | // data from the HTML5 data-* attribute |
| 2703 | if ( data === undefined && elem.nodeType === 1 ) { |
| 2704 | |
| 2705 | var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); |
| 2706 | |
| 2707 | data = elem.getAttribute( name ); |
| 2708 | |
| 2709 | if ( typeof data === "string" ) { |
| 2710 | try { |
| 2711 | data = data === "true" ? true : |
| 2712 | data === "false" ? false : |
| 2713 | data === "null" ? null : |
| 2714 | // Only convert to a number if it doesn't change the string |
| 2715 | +data + "" === data ? +data : |
| 2716 | rbrace.test( data ) ? jQuery.parseJSON( data ) : |
| 2717 | data; |
| 2718 | } catch( e ) {} |
| 2719 | |
| 2720 | // Make sure we set the data so it isn't changed later |
| 2721 | jQuery.data( elem, key, data ); |
| 2722 | |
| 2723 | } else { |
| 2724 | data = undefined; |
| 2725 | } |
| 2726 | } |
| 2727 | |
| 2728 | return data; |
| 2729 | } |
| 2730 | |
| 2731 | // checks a cache object for emptiness |
| 2732 | function isEmptyDataObject( obj ) { |
no outgoing calls
no test coverage detected
searching dependent graphs…