MCPcopy Index your code
hub / github.com/idank/explainshell / dataAttr

Function dataAttr

explainshell/web/static/js/jquery.js:1841–1870  ·  view source on GitHub ↗
( elem, key, data )

Source from the content-addressed store, hash-verified

1839});
1840
1841function 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
1873function isEmptyDataObject( obj ) {

Callers 1

jquery.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected