( elem, key, data )
| 1983 | }); |
| 1984 | |
| 1985 | function dataAttr( elem, key, data ) { |
| 1986 | // If nothing was found internally, try to fetch any |
| 1987 | // data from the HTML5 data-* attribute |
| 1988 | if ( data === undefined && elem.nodeType === 1 ) { |
| 1989 | |
| 1990 | var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); |
| 1991 | |
| 1992 | data = elem.getAttribute( name ); |
| 1993 | |
| 1994 | if ( typeof data === "string" ) { |
| 1995 | try { |
| 1996 | data = data === "true" ? true : |
| 1997 | data === "false" ? false : |
| 1998 | data === "null" ? null : |
| 1999 | jQuery.isNumeric( data ) ? +data : |
| 2000 | rbrace.test( data ) ? jQuery.parseJSON( data ) : |
| 2001 | data; |
| 2002 | } catch( e ) {} |
| 2003 | |
| 2004 | // Make sure we set the data so it isn't changed later |
| 2005 | jQuery.data( elem, key, data ); |
| 2006 | |
| 2007 | } else { |
| 2008 | data = undefined; |
| 2009 | } |
| 2010 | } |
| 2011 | |
| 2012 | return data; |
| 2013 | } |
| 2014 | |
| 2015 | // checks a cache object for emptiness |
| 2016 | function isEmptyDataObject( obj ) { |
no test coverage detected