Skip to content

fix: simplify getBoundingClientRect wrapper#9150

Open
PascalThuet wants to merge 3 commits intovideojs:mainfrom
PascalThuet:perf/simplify-getBoundingClientRect-wrapper
Open

fix: simplify getBoundingClientRect wrapper#9150
PascalThuet wants to merge 3 commits intovideojs:mainfrom
PascalThuet:perf/simplify-getBoundingClientRect-wrapper

Conversation

@PascalThuet
Copy link
Copy Markdown

@PascalThuet PascalThuet commented Feb 4, 2026

Summary

  • Remove the computedStyle fallback that was added for IE8 compatibility (no longer supported)
  • Return the native DOMRect directly instead of shallow-copying to a plain object
  • Update the unit test to reflect the new behavior

All call sites (seek-bar.js, time-tooltip.js, volume-bar.js, volume-level-tooltip.js) only read properties from the returned rect — none mutate it — so returning the native DOMRect is safe.

Test plan

  • Verified no call site mutates the returned rect
  • Existing unit tests pass (updated getBoundingClientRect test)
  • Seek bar scrubbing works correctly
  • Volume bar interaction works correctly
  • Time tooltip positioning works correctly

Fixes #9149

Remove the IE8 computedStyle fallback and the shallow-copy to a plain
object.  All modern browsers provide height/width on DOMRect and no call
site in the codebase mutates the returned rect, so we can safely return
the native DOMRect directly.

Fixes videojs#9149
@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.33%. Comparing base (9d2101e) to head (198e812).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #9150   +/-   ##
=======================================
  Coverage   84.32%   84.33%           
=======================================
  Files         120      120           
  Lines        8153     8144    -9     
  Branches     1964     1961    -3     
=======================================
- Hits         6875     6868    -7     
+ Misses       1278     1276    -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@PascalThuet PascalThuet changed the title perf: simplify getBoundingClientRect wrapper fix: simplify getBoundingClientRect wrapper Feb 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

perf: Remove obsolete IE8 computedStyle fallback in getBoundingClientRect wrapper

2 participants