Skip to content

Clarify OffscreenCanvas.transferToImageBitmap clearing canvas#43716

Merged
Josh-Cena merged 6 commits intomdn:mainfrom
narasimhan-lakshmi:fix/mdn-spec-offscreencanvas
Apr 8, 2026
Merged

Clarify OffscreenCanvas.transferToImageBitmap clearing canvas#43716
Josh-Cena merged 6 commits intomdn:mainfrom
narasimhan-lakshmi:fix/mdn-spec-offscreencanvas

Conversation

@narasimhan-lakshmi
Copy link
Copy Markdown
Contributor

Description

OffscreenCanvas.transferToImageBitmap() not only creates an ImageBitmap, but also replaces the OffscreenCanvas contents with a new blank image afterward.
Also, if needed to copy content to another canvas without that transfer side effect, you can use drawImage() with the OffscreenCanvas as the source

Motivation

These changes make reader to understand current working version. For OffscreenCanvas, the update makes the side effect explicit that reduces bugs.

Additional details

Related issues and pull requests

Fixes #43687

@narasimhan-lakshmi narasimhan-lakshmi requested review from a team as code owners April 8, 2026 17:38
@narasimhan-lakshmi narasimhan-lakshmi requested review from chrisdavidmills and dipikabh and removed request for a team April 8, 2026 17:38
@github-actions github-actions bot added Content:CSS Cascading Style Sheets docs Content:WebAPI Web API docs Content:Learn Learning area docs Content:SVG SVG docs Content:Media Media docs Content:Glossary Glossary entries size/m [PR only] 51-500 LoC changed labels Apr 8, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 8, 2026

Preview URLs (1 page)

(comment last updated: 2026-04-08 18:18:35)

@Josh-Cena Josh-Cena changed the title Fix/mdn spec offscreencanvas Clarify OffscreenCanvas.transferToImageBitmap clearing canvas Apr 8, 2026
@github-actions github-actions bot added size/s [PR only] 6-50 LoC changed and removed Content:CSS Cascading Style Sheets docs Content:SVG SVG docs Content:Media Media docs Content:Glossary Glossary entries size/m [PR only] 51-500 LoC changed labels Apr 8, 2026
@github-actions github-actions bot removed the Content:Learn Learning area docs label Apr 8, 2026
Copy link
Copy Markdown
Member

@Josh-Cena Josh-Cena left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice. Thank you. Next time remember to submit with a clean branch.

@Josh-Cena Josh-Cena removed request for a team, chrisdavidmills and dipikabh April 8, 2026 18:16
@Josh-Cena Josh-Cena merged commit 02b5541 into mdn:main Apr 8, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Content:WebAPI Web API docs size/s [PR only] 6-50 LoC changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

transferToImageBitmap misses information that the "image in the OffscreenCanvas object is replaced with a new blank image."

3 participants