| 3777 | rmultiDash = /([A-Z])/g; |
| 3778 | |
| 3779 | function dataAttr( elem, key, data ) { |
| 3780 | |
| 3781 | // If nothing was found internally, try to fetch any |
| 3782 | // data from the HTML5 data-* attribute |
| 3783 | if ( data === undefined && elem.nodeType === 1 ) { |
| 3784 | |
| 3785 | var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); |
| 3786 | |
| 3787 | data = elem.getAttribute( name ); |
| 3788 | |
| 3789 | if ( typeof data === "string" ) { |
| 3790 | try { |
| 3791 | data = data === "true" ? true : |
| 3792 | data === "false" ? false : |
| 3793 | data === "null" ? null : |
| 3794 | |
| 3795 | // Only convert to a number if it doesn't change the string |
| 3796 | +data + "" === data ? +data : |
| 3797 | rbrace.test( data ) ? jQuery.parseJSON( data ) : |
| 3798 | data; |
| 3799 | } catch ( e ) {} |
| 3800 | |
| 3801 | // Make sure we set the data so it isn't changed later |
| 3802 | jQuery.data( elem, key, data ); |
| 3803 | |
| 3804 | } else { |
| 3805 | data = undefined; |
| 3806 | } |
| 3807 | } |
| 3808 | |
| 3809 | return data; |
| 3810 | } |
| 3811 | |
| 3812 | // checks a cache object for emptiness |
| 3813 | function isEmptyDataObject( obj ) { |