JSFiddle - React, Tailwind, and code Playground
HTML
<div id="details">Two seconds after dojo.ready fires, the div below will be styled.</div>
<div id="hello">Hello dojo.style!</div>
CSS
#hello { border: 1px solid black; }
div { margin: 5px 0px; padding: 5px; }
JavaScript
// All code in this fiddle is MIT license,
// which is to say, I don't really care if you take it.
// Have fun! :)
dojo.ready(function() {
// Hook up to dojo.style
dojo.connect(dojo, 'style', function(node, attribute, value) {
// We only care when it's a call with exactly three args
if (arguments.length != 3) {
return;
}
// The node arg can be either a string or a node,
// but I prefer to log nodes for debugging
node = dojo.byId(node);
// Do we warn or log?
var method = (value === undefined || value === null || value === '' || value.toString().indexOf('NaN') !== -1 ? 'warn' : 'log');
// Push it to the console!
console[method]('Setting "' + attribute + '" to "' + value + '" on ', node, " args: ", arguments);
});
// In two seconds, as per the HTML, style it up
setTimeout(function() {
dojo.style('hello', 'background-color', 'yellow');
}, 2000);
});