JSFiddle - React, Tailwind, and code Playground
HTML
<div display="false">Test.</div>
<div display="true">Test.</div>
<div display="true">Test.</div>
<div display="false">Test.</div>
<div display="false">Test.</div>
<div display="false">Test.</div>
JavaScript
// Sample elements just to test. It can be XML Elements, sure.
var data = $("div");
// Slower first option (1.099ms on Firebug Profile):
data = data.filter(function (a) {
return ($(this).attr('display') == "true");
});
data.each(function () {
$(this).css({ color: "red" });
});
// Faster second option (1.037ms on Firebug Profile):
/*
data.each(function () {
if ($(this).attr("display") == "true") {
$(this).css({ color: "red" });
}
});
*/