| 3673 | rmultiDash = /([A-Z])/g; |
| 3674 | |
| 3675 | function dataAttr( elem, key, data ) { |
| 3676 | var name; |
| 3677 | |
| 3678 | // If nothing was found internally, try to fetch any |
| 3679 | // data from the HTML5 data-* attribute |
| 3680 | if ( data === undefined && elem.nodeType === 1 ) { |
| 3681 | name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); |
| 3682 | data = elem.getAttribute( name ); |
| 3683 | |
| 3684 | if ( typeof data === "string" ) { |
| 3685 | try { |
| 3686 | data = data === "true" ? true : |
| 3687 | data === "false" ? false : |
| 3688 | data === "null" ? null : |
| 3689 | // Only convert to a number if it doesn't change the string |
| 3690 | +data + "" === data ? +data : |
| 3691 | rbrace.test( data ) ? jQuery.parseJSON( data ) : |
| 3692 | data; |
| 3693 | } catch( e ) {} |
| 3694 | |
| 3695 | // Make sure we set the data so it isn't changed later |
| 3696 | data_user.set( elem, key, data ); |
| 3697 | } else { |
| 3698 | data = undefined; |
| 3699 | } |
| 3700 | } |
| 3701 | return data; |
| 3702 | } |
| 3703 | |
| 3704 | jQuery.extend({ |
| 3705 | hasData: function( elem ) { |