Files
servo/components/script/dom
Busy Beaver 0a4dd17566 script: Do not conflate shadow roots and the Document element in element.scrollLeft and similar methods (#41234)
This PR fixes an issue where the Shadow DOM roots were incorrectly
identified as the document roots in scroll and dimension calculations.
The previous check `*self.root_element() == *self` returned true for
shadow roots which caused `scrollTop`, `scrollLeft`, `clientWidth` to
return viewport dimensions instead of actual dimensions. The previous
check was replaced with the already existing
`self.is_document_element()` to check for actual roots.

Testing: 
 - This causes `shadow-dom/scroll-restore-shadow.html` to start passing.
- It was also locally tested on the tests given by @rayguo17 (
[clientWidth
Test](https://github.com/servo/servo/issues/41002#issue-3684265503) and
[scrollTop
Test](https://github.com/servo/servo/issues/41002#issuecomment-3605214797)
)

   Test results: 
   ```
   No build type specified so assuming `--dev`.
   shadow_host_client_width:  300
   shadow_root_element_client_width:  300
   
   No build type specified so assuming `--dev`.
   shadow host scrollTop:  0
   shadow_root_element_scrollTop:  0
   document root element scrollTop:  536
   Button in shadow DOM clicked
   ```

Fixes: #41002

---------

Signed-off-by: zen-zap <pandaashutosh340@gmail.com>
2025-12-13 10:37:19 +00:00
..
2025-11-24 13:49:51 +00:00
2025-12-05 07:23:32 +00:00
2025-08-19 11:07:53 +00:00