v1
- by source144 6/4/202100
disable setup HTML
Setup HTML
<div id="tester"></div>
<span id="result"></span>
<span id="classes"></span>

<script
  src="https://code.jquery.com/jquery-3.6.0.min.js"
  integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4="
  crossorigin="anonymous"></script>

<script>
$(document).ready(function () {
	const _numWords = 10000;
	const res = await fetch(`https://random-word-api.herokuapp.com/word?number=${_numWords}`);
	const _words = await res.json();
	const _classes = _words.join(' ');

	$("#tester").addClass(_classes);

	function generateUUID() {
  		//Generates a GUID code
  		var d = new Date().getTime();
  		var d2 = (performance && performance.now && (performance.now() * 1000)) || 0;//Time in microseconds since page-load or 0 if unsupported
  		return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
    		var r = Math.random() * 16;
    		if (d > 0) {
      			r = (d + r) % 16 | 0;
      			d = Math.floor(d / 16);
    		} else {
      			r = (d2 + r) % 16 | 0;
      			d2 = Math.floor(d2 / 16);
    		}
    		return (c === 'x' ? r : (r & 0x3 | 0x8)).toString(16);
  		});
	}

	$.fn.extend({
		hasClasses: function (selectors) {
  			for (var i in selectors) {
  				if ($(this).hasClass(selectors[i])) 
  					return true;
  			}
  			return false;
  		},
  		hasClassesById: function (selectors) {
      		// Setup
      		const _id = $(this).attr('id'); // Preserve existing id
      		const uuid = generateUUID();    // Create new id for query
      		$(this).attr('id', uuid);       // Apply new id to element
     
   			// Query to find if element has any of the classes
      		const res = selectors.some(cls => !!$(`${uuid}.${cls}`).length);
      
            // Rollback on id	
      		if (!_id) $(this).removeAttr("id"); // No Id to begin with
      		else $(this).attr('id', _id);       // Preserve old id
      
      		// Done
      		return res;
    	}
	});
});
</script>
disable setup JavaScript
Setup JavaScript
$("#classes").text($('#classes').attr("class").split(/\s+/);)
delete caserun single casemove downdrag and drop case


ready



$("#classes").text($('#classes').attr("class").split(/\s+/);)
delete caserun single casemove updrag and drop case


ready



$("#classes").text($('#classes').attr("class").split(/\s+/);)
Test Case - click to add another test case
Teardown JS - click to add teardown JavaScript
Output (DOM) - click to monitor output (DOM) while test is running
RUN