| 1839 | }); |
| 1840 | |
| 1841 | function dataAttr( elem, key, data ) { |
| 1842 | // If nothing was found internally, try to fetch any |
| 1843 | // data from the HTML5 data-* attribute |
| 1844 | if ( data === undefined && elem.nodeType === 1 ) { |
| 1845 | |
| 1846 | var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); |
| 1847 | |
| 1848 | data = elem.getAttribute( name ); |
| 1849 | |
| 1850 | if ( typeof data === "string" ) { |
| 1851 | try { |
| 1852 | data = data === "true" ? true : |
| 1853 | data === "false" ? false : |
| 1854 | data === "null" ? null : |
| 1855 | // Only convert to a number if it doesn't change the string |
| 1856 | +data + "" === data ? +data : |
| 1857 | rbrace.test( data ) ? jQuery.parseJSON( data ) : |
| 1858 | data; |
| 1859 | } catch( e ) {} |
| 1860 | |
| 1861 | // Make sure we set the data so it isn't changed later |
| 1862 | jQuery.data( elem, key, data ); |
| 1863 | |
| 1864 | } else { |
| 1865 | data = undefined; |
| 1866 | } |
| 1867 | } |
| 1868 | |
| 1869 | return data; |
| 1870 | } |
| 1871 | |
| 1872 | // checks a cache object for emptiness |
| 1873 | function isEmptyDataObject( obj ) { |