JSFiddle - React, Tailwind, and code Playground
HTML
<span id="test-1">This text should be blue</span>
<span id="test-2" data-test="example">This text should be red</span>
CSS
body {
color: #00F;
}
[data-test] {
color: #F00;
}
JavaScript
(function () {
var t1,
t2;
t1 = $('#test-1').attr('data-test');
t2 = $('#test-2').attr('data-test');
$('#test-1, #test-2').attr('data-test', 'intermediary state');
$('#test-1').attr('data-test', t1);
$('#test-2').attr('data-test', t2);
console.assert(!$('#test-1').is('[data-test]'), 'Passing the original value of [data-test] should return #test-1 to its original state.');
console.assert($('#test-2').is('[data-test]'), 'Passing the original value of [data-test] should return #test-2 to its original state.');
}());