mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 04:12:43 +00:00 
			
		
		
		
	 cda1d886df
			
		
	
	
		cda1d886df
		
	
	
	
	
		
			
			Fixes following mistakes: - "scrolling box" for a document is not `scrollable_overflow_rect()` but size of viewport (initial containing block, like spec says). - comparing edges of "scrolling box" with edges of target element does not make any sense because "scrolling box" edges are relative to page while result of `get_bounding_client_rect()` is relative to viewport.
		
			
				
	
	
		
			29 lines
		
	
	
	
		
			737 B
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			29 lines
		
	
	
	
		
			737 B
		
	
	
	
		
			HTML
		
	
	
	
	
	
| <script src="include.js"></script>
 | |
| <style>
 | |
|     body {
 | |
|         margin: 0;
 | |
|     }
 | |
| 
 | |
|     #box {
 | |
|         width: 200px;
 | |
|         height: 200px;
 | |
|         background-color: magenta;
 | |
|     }
 | |
| </style>
 | |
| <div style="height: 1000px"></div>
 | |
| <div style="margin-left: 500px" onclick="clickHandler(event)" id="box"></div>
 | |
| <div style="height: 1000px"></div>
 | |
| <script>
 | |
|     function clickHandler(event) {
 | |
|         document.getElementById("box").scrollIntoView({ block: "end" });
 | |
|     }
 | |
| 
 | |
|     asyncTest(done => {
 | |
|         document.addEventListener("scroll", event => {
 | |
|             println("The page has been scrolled to y: " + window.scrollY);
 | |
|             done();
 | |
|         });
 | |
| 
 | |
|         document.getElementById("box").dispatchEvent(new Event("click"));
 | |
|     });
 | |
| </script>
 |