JSFiddle - React, Tailwind, and code Playground
by olov
HTML
<div>
<span class="foo"></span>
<!-- comment -->
text
</div>
JavaScript
var $div = jQuery("div"),
$nodes = $div.contents();
console.log(
( !$div.hasClass("undefined") && "PASS" ) || "FAIL",
" - DIV DOES NOT have a class 'undefined'"
);
console.log(
( $nodes.hasClass("foo") && "PASS" ) || "FAIL",
" - Elements DOES have a class 'foo'"
);
console.log(
( !$nodes.hasClass("undefined") && "PASS" ) || "FAIL",
" - Elements DOES NOT have a class 'undefined'"
);