MCPcopy Create free account
hub / github.com/apache/cloudstack / dataAttr

Function dataAttr

tools/ngui/static/js/lib/jquery-1.7.2.js:1985–2013  ·  view source on GitHub ↗
( elem, key, data )

Source from the content-addressed store, hash-verified

1983});
1984
1985function 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
2016function isEmptyDataObject( obj ) {

Callers 1

jquery-1.7.2.jsFile · 0.85

Calls 4

replaceMethod · 0.80
getAttributeMethod · 0.80
testMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected