| 1799 | }); |
| 1800 | |
| 1801 | function dataAttr( elem, key, data ) { |
| 1802 | // If nothing was found internally, try to fetch any |
| 1803 | // data from the HTML5 data-* attribute |
| 1804 | if ( data === undefined && elem.nodeType === 1 ) { |
| 1805 | |
| 1806 | var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); |
| 1807 | |
| 1808 | data = elem.getAttribute( name ); |
| 1809 | |
| 1810 | if ( typeof data === "string" ) { |
| 1811 | try { |
| 1812 | data = data === "true" ? true : |
| 1813 | data === "false" ? false : |
| 1814 | data === "null" ? null : |
| 1815 | // Only convert to a number if it doesn't change the string |
| 1816 | +data + "" === data ? +data : |
| 1817 | rbrace.test( data ) ? jQuery.parseJSON( data ) : |
| 1818 | data; |
| 1819 | } catch( e ) {} |
| 1820 | |
| 1821 | // Make sure we set the data so it isn't changed later |
| 1822 | jQuery.data( elem, key, data ); |
| 1823 | |
| 1824 | } else { |
| 1825 | data = undefined; |
| 1826 | } |
| 1827 | } |
| 1828 | |
| 1829 | return data; |
| 1830 | } |
| 1831 | |
| 1832 | // checks a cache object for emptiness |
| 1833 | function isEmptyDataObject( obj ) { |