Call Element.setCapture() during a mousedown handler to retarget mouse events to that element until the button is released or document.releaseCapture() runs (MDN). Prefer modern setPointerCapture().
Pass the required arguments shown below. Check return values and browser support before you rely on the result.
Syntax
Call el.setCapture. Start with this line.
JavaScript
el.setCapture(retargetToElement?)
Call
What it does
el.setCapture(retargetToElement?)
Primary signature.
el.setCapture(...)
Call with the arguments your case needs.
Built into the browser. Call setCapture(...) on an Element — no import required.
Library declarations
JavaScript
el.setCapture(retargetToElement?)
Parameters
Parameter
Description
retargetToElement
Optional. true = this element only; false = include descendants
pointerdown. Capture that pointer Id on the element.
pointermove. Events keep targeting the element while captured.
pointerup. Release when done.
Portable. Works across modern browsers — unlike setCapture.
Compatibility
Browser Support
Element.setCapture() is Deprecated and Non-standard on MDN — not part of any specification, and never had broad cross-browser support. Prefer setPointerCapture().
✓ Deprecated · Non-standard
Element.setCapture()
Legacy Gecko mouse capture during mousedown. Use Pointer Events setPointerCapture() for new code.
LegacyAvoid in new code
Google ChromeSupported · Desktop & Mobile
Full support
Mozilla FirefoxSupported · Desktop & Mobile
Full support
Apple SafariSupported · macOS & iOS
Full support
Microsoft EdgeSupported · Chromium
Full support
Internet ExplorerNo native support · Use a polyfill
Polyfill
OperaSupported · Modern versions
Full support
Samsung InternetSupported · Android
Full support
Android WebViewSupported · Modern WebView
Full support
setCapture()Deprecated
Bottom line: Do not ship setCapture() in production. Feature-detect only for legacy maintenance; migrate to setPointerCapture().
Frequently Asked Questions
During mousedown handling, it retargets mouse events to this element until the mouse button is released or document.releaseCapture() is called (MDN).
MDN marks Element.setCapture() as Deprecated and Non-standard. It is not Experimental and is not part of any specification — do not use it in new projects.
undefined. There is no return value (MDN).
Optional boolean. true targets all events directly at this element; false allows events on descendants too (MDN).
MDN recommends Element.setPointerCapture() from the Pointer Events API for modern pointer capture / drag workflows.
No practical cross-browser support. MDN notes it never had much cross-browser support (legacy Gecko).