mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 00:32:45 +00:00 
			
		
		
		
	 79fa892ca1
			
		
	
	
		79fa892ca1
		
	
	
	
	
		
			
			This allows developers to open LibWeb test html files in Ladybird or in other browsers to observe their behavior without the internals object.
		
			
				
	
	
		
			31 lines
		
	
	
	
		
			787 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			31 lines
		
	
	
	
		
			787 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| var __outputElement = null;
 | |
| 
 | |
| if (globalThis.internals === undefined) {
 | |
|     internals = {
 | |
|         signalTextTestIsDone: function () {},
 | |
|     };
 | |
| }
 | |
| 
 | |
| function println(s) {
 | |
|     __outputElement.appendChild(document.createTextNode(s + "\n"));
 | |
| }
 | |
| 
 | |
| document.addEventListener("DOMContentLoaded", function () {
 | |
|     __outputElement = document.createElement("pre");
 | |
|     __outputElement.setAttribute("id", "out");
 | |
|     document.body.appendChild(__outputElement);
 | |
| });
 | |
| 
 | |
| function test(f) {
 | |
|     document.addEventListener("DOMContentLoaded", f);
 | |
|     window.addEventListener("load", () => {
 | |
|         internals.signalTextTestIsDone();
 | |
|     });
 | |
| }
 | |
| 
 | |
| function asyncTest(f) {
 | |
|     const done = () => internals.signalTextTestIsDone();
 | |
|     document.addEventListener("DOMContentLoaded", () => {
 | |
|         f(done);
 | |
|     });
 | |
| }
 |