Element.hasPointerCapture() is an instance method that returns true or false depending on whether this element currently holds pointer capture for a given pointerId. Learn the MDN pointerdown pattern with setPointerCapture() and releasePointerCapture(), drag-handler guards, and five try-it labs aligned with MDN.
01
Kind
Instance method
02
Returns
boolean
03
Arg
pointerId
04
Capture
true / false
05
Events
Pointer
06
Status
Baseline widely
Fundamentals
Introduction
When a user presses a mouse button, touches a screen, or uses a pen, the browser fires Pointer Events with a unique pointerId. Normally, events target the element under the pointer. With setPointerCapture(pointerId), an element can keep receiving pointer events even when the pointer moves outside it — useful for dragging sliders, drawing pads, and custom controls.
hasPointerCapture(pointerId) lets you check whether your element currently owns that pointer. MDN: it returns whether the element has pointer capture for the pointer identified by the given pointer ID.
💡
Beginner tip
Call hasPointerCapture inside pointerdown, pointermove, or pointerup handlers where event.pointerId is valid. Pass that same ID to the method.
Element.hasPointerCapture() is Baseline Widely available (MDN: across browsers since July 2020). Logos use the shared browser-image-sprite.png sprite from this project.
✓ Baseline Widely available
Element.hasPointerCapture()
Check whether an element has pointer capture for a pointerId — returns true or false.
BaselineWidely available
Google ChromeSupported · Desktop & Mobile
Yes
Microsoft EdgeSupported · Chromium
Yes
Mozilla FirefoxSupported · Desktop & Mobile
Yes
Apple SafariSupported · macOS & iOS
Yes
OperaSupported · Modern versions
Yes
Internet ExplorerNot supported
No
hasPointerCapture()Excellent
Bottom line: Use hasPointerCapture() to confirm capture before handling pointermove or pointerup. Request capture with setPointerCapture() first.
Wrap Up
Conclusion
Element.hasPointerCapture() checks whether an element currently holds pointer capture for a given pointerId. It is the read-only companion to setPointerCapture() and releasePointerCapture().
Use Pointer Events for mouse, touch, and pen input
❌ Don’t
Call without a real pointerId from an event
Confuse with setting capture (use setPointerCapture)
Assume capture lasts forever without release
Check capture on the wrong element
Rely on mouse-only events for cross-device UIs
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about Element.hasPointerCapture()
Pointer capture state checks.
5
Core concepts
📝01
Returns
boolean
API
📄02
Arg
pointerId
Event
👆03
Capture
set/release
Pair
✅04
Drag
guard
move
⚡05
API
Pointer
Events
❓ Frequently Asked Questions
It returns a boolean indicating whether the element has pointer capture for the pointer identified by the given pointer ID (MDN).
No. MDN marks Element.hasPointerCapture() as Baseline Widely available (across browsers since July 2020). It is not Deprecated, Experimental, or Non-standard.
The pointerId from a PointerEvent object (for example event.pointerId from pointerdown, pointermove, or pointerup).
When the element currently holds pointer capture for that pointerId — typically after setPointerCapture(pointerId) and before releasePointerCapture(pointerId) or pointerup.
setPointerCapture() requests capture for a pointer. hasPointerCapture() only checks whether capture is already active on this element.
Useful in drag handlers and custom sliders: confirm your element still owns the pointer before handling pointermove or pointerup events (MDN).
Did you know?
MDN: after setPointerCapture(pointerId), call hasPointerCapture(pointerId) to confirm your element still owns the pointer before handling follow-up pointer events.