JSFiddle - React, Tailwind, and code Playground
by seankoole
HTML
<div id="parent"><span id="test" data-foo="this is foo"></span></div>
JavaScript
/*
jQuery 1.4.2 vs 1.4.3 -- data method reads from the attribute
* Events setData and getData changes
Default is set to 1.4.3, select 1.4.2 and click run
*/
var span = $('#test');
var div = $('#parent');
/*
See if it bubbles
*/
div.bind ('getData',
function ()
{
console.log ('bubbles get');
}
);
div.bind ('setData',
function ()
{
console.log ('bubbles set');
}
);
/*
1.4.3 = nothing
1.4.2 = nothing
*/
span.data ('foo');
/*
1.4.3 = nothing
1.4.2 = bubbles set
*/
span.data ('bar', 'something else');
/*
1.4.3 = nothing
1.4.2 = bubbles set (strangely enough)
*/
span.data ('bar', 'something else');
/*
1.4.3 = nothing
1.4.2 = nothing
*/
span.data ('bar');