The gotpointercapture
event is fired when an element captures a pointer using setPointerCapture()
.
Bubbles | Yes |
---|---|
Cancelable | No |
Interface | PointerEvent |
Event handler property | ongotpointercapture |
Examples
This example gets a <p>
element and listens for the gotpointercapture
event. It then calls setPointerCapture()
on the element on a pointerdown
event, which will trigger gotpointercapture
.
const para = document.querySelector('p'); para.addEventListener('gotpointercapture', () => { console.log('I\'ve been captured!') }); para.addEventListener('pointerdown', (event) => { para.setPointerCapture(event.pointerId); });
The same example, using the ongotpointercapture
event handler property:
const para = document.querySelector('p'); para.ongotpointercapture = () => { console.log('I\'ve been captured!') }; para.addEventListener('pointerdown', (event) => { para.setPointerCapture(event.pointerId); });
Specifications
Specification | Status |
---|---|
Pointer Events | Obsolete |
Browser compatibility
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
gotpointercapture event | Chrome Full support 57 | Edge Full support ≤79 | Firefox Full support 59 | IE ? | Opera Full support 44 | Safari ? | WebView Android Full support 57 | Chrome Android Full support 57 | Firefox Android No support No | Opera Android Full support 43 | Safari iOS ? | Samsung Internet Android Full support 7.0 |
Legend
- Full support
- Full support
- No support
- No support
- Compatibility unknown
- Compatibility unknown
See also
- Related events
ongotpointercapture
event handler property- This event on
Document
targets:gotpointercapture
event