Kind of sad that itβs 2025 and we still donβt have a reliable way to screenshot DOM elements via JS.
Using an SVG with a foreignObject and drawing that to a canvas gets close, but getting external resources like fonts and images to load is a pain. π Not to mention things like checked checkboxes.
Thereβs a way to use getDisplayMedia() and restrict that to a specific element, but the API is desktop Chrome-only. π