mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 08:32:43 +00:00 
			
		
		
		
	 fd297a3248
			
		
	
	
		fd297a3248
		
	
	
	
	
		
			
			For example, when clicking the document body outside of a focused input element, we should unfocus that element.
		
			
				
	
	
		
			23 lines
		
	
	
	
		
			537 B
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			23 lines
		
	
	
	
		
			537 B
		
	
	
	
		
			HTML
		
	
	
	
	
	
| <input id=input type=text>
 | |
| <script src="include.js"></script>
 | |
| <script>
 | |
|     test(() => {
 | |
|         let input = document.getElementById("input");
 | |
| 
 | |
|         input.addEventListener("focus", () => {
 | |
|             println("focus");
 | |
|         });
 | |
| 
 | |
|         input.addEventListener("blur", () => {
 | |
|             println("blur");
 | |
|         });
 | |
| 
 | |
|         input.focus();
 | |
| 
 | |
|         const rect = input.getBoundingClientRect();
 | |
|         const x = rect.x + rect.width;
 | |
|         const y = rect.y + rect.height;
 | |
| 
 | |
|         internals.click(x + 10, y + 10);
 | |
|     })
 | |
| </script>
 |