Skip to content

Commit

Permalink
Move pointerlock events to Element (mdn#20806)
Browse files Browse the repository at this point in the history
  • Loading branch information
Elchi3 authored and Himanshu Garg committed Sep 27, 2022
1 parent 82df965 commit 9c4fcf7
Show file tree
Hide file tree
Showing 10 changed files with 50 additions and 51 deletions.
19 changes: 10 additions & 9 deletions files/en-us/_redirects.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1495,8 +1495,8 @@
/en-US/docs/DOM/Mozilla_event_reference/pause /en-US/docs/Web/API/HTMLMediaElement/pause_event
/en-US/docs/DOM/Mozilla_event_reference/play /en-US/docs/Web/API/HTMLMediaElement/play_event
/en-US/docs/DOM/Mozilla_event_reference/playing /en-US/docs/Web/API/HTMLMediaElement/playing_event
/en-US/docs/DOM/Mozilla_event_reference/pointerlockchange /en-US/docs/Web/API/Document/pointerlockchange_event
/en-US/docs/DOM/Mozilla_event_reference/pointerlockerror /en-US/docs/Web/API/Document/pointerlockerror_event
/en-US/docs/DOM/Mozilla_event_reference/pointerlockchange /en-US/docs/Web/API/Element/pointerlockchange_event
/en-US/docs/DOM/Mozilla_event_reference/pointerlockerror /en-US/docs/Web/API/Element/pointerlockerror_event
/en-US/docs/DOM/Mozilla_event_reference/popstate /en-US/docs/Web/API/Window/popstate_event
/en-US/docs/DOM/Mozilla_event_reference/progress /en-US/docs/Web/API/XMLHttpRequest/progress_event
/en-US/docs/DOM/Mozilla_event_reference/ratechange /en-US/docs/Web/API/HTMLMediaElement/ratechange_event
Expand Down Expand Up @@ -6266,8 +6266,8 @@
/en-US/docs/Mozilla_event_reference/pause /en-US/docs/Web/API/HTMLMediaElement/pause_event
/en-US/docs/Mozilla_event_reference/play /en-US/docs/Web/API/HTMLMediaElement/play_event
/en-US/docs/Mozilla_event_reference/playing /en-US/docs/Web/API/HTMLMediaElement/playing_event
/en-US/docs/Mozilla_event_reference/pointerlockchange /en-US/docs/Web/API/Document/pointerlockchange_event
/en-US/docs/Mozilla_event_reference/pointerlockerror /en-US/docs/Web/API/Document/pointerlockerror_event
/en-US/docs/Mozilla_event_reference/pointerlockchange /en-US/docs/Web/API/Element/pointerlockchange_event
/en-US/docs/Mozilla_event_reference/pointerlockerror /en-US/docs/Web/API/Element/pointerlockerror_event
/en-US/docs/Mozilla_event_reference/popstate /en-US/docs/Web/API/Window/popstate_event
/en-US/docs/Mozilla_event_reference/progress /en-US/docs/Web/API/XMLHttpRequest/progress_event
/en-US/docs/Mozilla_event_reference/ratechange /en-US/docs/Web/API/HTMLMediaElement/ratechange_event
Expand Down Expand Up @@ -7949,6 +7949,8 @@
/en-US/docs/Web/API/Document/pointerdown_event /en-US/docs/Web/API/Element/pointerdown_event
/en-US/docs/Web/API/Document/pointerenter_event /en-US/docs/Web/API/Element/pointerenter_event
/en-US/docs/Web/API/Document/pointerleave_event /en-US/docs/Web/API/Element/pointerleave_event
/en-US/docs/Web/API/Document/pointerlockchange_event /en-US/docs/Web/API/Element/pointerlockchange_event
/en-US/docs/Web/API/Document/pointerlockerror_event /en-US/docs/Web/API/Element/pointerlockerror_event
/en-US/docs/Web/API/Document/pointermove_event /en-US/docs/Web/API/Element/pointermove_event
/en-US/docs/Web/API/Document/pointerout_event /en-US/docs/Web/API/Element/pointerout_event
/en-US/docs/Web/API/Document/pointerover_event /en-US/docs/Web/API/Element/pointerover_event
Expand Down Expand Up @@ -8049,7 +8051,6 @@
/en-US/docs/Web/API/Element/ongotpointercapture /en-US/docs/Web/API/Element/gotpointercapture_event
/en-US/docs/Web/API/Element/onlostpointercapture /en-US/docs/Web/API/Element/lostpointercapture_event
/en-US/docs/Web/API/Element/onwheel /en-US/docs/Web/API/Element/wheel_event
/en-US/docs/Web/API/Element/pointerlockchange_event /en-US/docs/Web/API/Document/pointerlockchange_event
/en-US/docs/Web/API/Element/resourcetimingbufferfull_event /en-US/docs/Web/API/Performance/resourcetimingbufferfull_event
/en-US/docs/Web/API/Element/select_event /en-US/docs/Web/API/HTMLInputElement/select_event
/en-US/docs/Web/API/Element/tabStop /en-US/docs/Web/API/ShadowRoot/delegatesFocus
Expand Down Expand Up @@ -11605,8 +11606,8 @@
/en-US/docs/Web/Events/pointerdown /en-US/docs/Web/API/Element/pointerdown_event
/en-US/docs/Web/Events/pointerenter /en-US/docs/Web/API/Element/pointerenter_event
/en-US/docs/Web/Events/pointerleave /en-US/docs/Web/API/Element/pointerleave_event
/en-US/docs/Web/Events/pointerlockchange /en-US/docs/Web/API/Document/pointerlockchange_event
/en-US/docs/Web/Events/pointerlockerror /en-US/docs/Web/API/Document/pointerlockerror_event
/en-US/docs/Web/Events/pointerlockchange /en-US/docs/Web/API/Element/pointerlockchange_event
/en-US/docs/Web/Events/pointerlockerror /en-US/docs/Web/API/Element/pointerlockerror_event
/en-US/docs/Web/Events/pointermove /en-US/docs/Web/API/Element/pointermove_event
/en-US/docs/Web/Events/pointerout /en-US/docs/Web/API/Element/pointerout_event
/en-US/docs/Web/Events/pointerover /en-US/docs/Web/API/Element/pointerover_event
Expand Down Expand Up @@ -12430,8 +12431,8 @@
/en-US/docs/Web/Reference/Events/pause /en-US/docs/Web/API/HTMLMediaElement/pause_event
/en-US/docs/Web/Reference/Events/play /en-US/docs/Web/API/HTMLMediaElement/play_event
/en-US/docs/Web/Reference/Events/playing /en-US/docs/Web/API/HTMLMediaElement/playing_event
/en-US/docs/Web/Reference/Events/pointerlockchange /en-US/docs/Web/API/Document/pointerlockchange_event
/en-US/docs/Web/Reference/Events/pointerlockerror /en-US/docs/Web/API/Document/pointerlockerror_event
/en-US/docs/Web/Reference/Events/pointerlockchange /en-US/docs/Web/API/Element/pointerlockchange_event
/en-US/docs/Web/Reference/Events/pointerlockerror /en-US/docs/Web/API/Element/pointerlockerror_event
/en-US/docs/Web/Reference/Events/popstate /en-US/docs/Web/API/Window/popstate_event
/en-US/docs/Web/Reference/Events/progress /en-US/docs/Web/API/XMLHttpRequest/progress_event
/en-US/docs/Web/Reference/Events/ratechange /en-US/docs/Web/API/HTMLMediaElement/ratechange_event
Expand Down
48 changes: 24 additions & 24 deletions files/en-us/_wikihistory.json
Original file line number Diff line number Diff line change
Expand Up @@ -30224,30 +30224,6 @@
"Jeremie"
]
},
"Web/API/Document/pointerlockchange_event": {
"modified": "2020-10-15T21:20:38.289Z",
"contributors": [
"mfuji09",
"wbamberg",
"fscholz",
"teoli",
"Sheppy",
"ethertank",
"louisremi"
]
},
"Web/API/Document/pointerlockerror_event": {
"modified": "2020-10-15T21:20:35.814Z",
"contributors": [
"mfuji09",
"wbamberg",
"fscholz",
"teoli",
"Sheppy",
"ethertank",
"louisremi"
]
},
"Web/API/Document/preferredStyleSheetSet": {
"modified": "2020-10-15T21:13:11.203Z",
"contributors": [
Expand Down Expand Up @@ -33669,6 +33645,30 @@
"AFBarstow"
]
},
"Web/API/Element/pointerlockchange_event": {
"modified": "2020-10-15T21:20:38.289Z",
"contributors": [
"mfuji09",
"wbamberg",
"fscholz",
"teoli",
"Sheppy",
"ethertank",
"louisremi"
]
},
"Web/API/Element/pointerlockerror_event": {
"modified": "2020-10-15T21:20:35.814Z",
"contributors": [
"mfuji09",
"wbamberg",
"fscholz",
"teoli",
"Sheppy",
"ethertank",
"louisremi"
]
},
"Web/API/Element/pointermove_event": {
"modified": "2020-10-15T21:39:52.216Z",
"contributors": [
Expand Down
2 changes: 1 addition & 1 deletion files/en-us/web/api/document/exitpointerlock/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ The **`exitPointerLock()`** method asynchronously releases a
pointer lock previously requested through {{domxref("Element.requestPointerLock")}}.

To track the success or failure of the request, it is necessary to listen for the
{{domxref("Document/pointerlockchange_event", "pointerlockchange")}} and {{domxref("Document/pointerlockerror_event", "pointerlockerror")}} events.
{{domxref("Element/pointerlockchange_event", "pointerlockchange")}} and {{domxref("Element/pointerlockerror_event", "pointerlockerror")}} events.

## Syntax

Expand Down
4 changes: 2 additions & 2 deletions files/en-us/web/api/document/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -400,9 +400,9 @@ Listen to these events using `addEventListener()` or by assigning an event liste
- : Fired when a pointer is moved into the hit test boundaries of an element or one of its descendants.
- {{DOMxRef("Document/pointerleave_event", "pointerleave")}}
- : Fired when a pointer is moved out of the hit test boundaries of an element.
- {{DOMxRef("Document/pointerlockchange_event", "pointerlockchange")}}
- {{DOMxRef("Element/pointerlockchange_event", "pointerlockchange")}}
- : Fired when the pointer is locked/unlocked.
- {{DOMxRef("Document/pointerlockerror_event", "pointerlockerror")}}
- {{DOMxRef("Element/pointerlockerror_event", "pointerlockerror")}}
- : Fired when locking the pointer failed.
- {{DOMxRef("Document/pointermove_event", "pointermove")}}
- : Fired when a pointer changes coordinates.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
---
title: 'Document: pointerlockchange event'
slug: Web/API/Document/pointerlockchange_event
title: 'Element: pointerlockchange event'
slug: Web/API/Element/pointerlockchange_event
page-type: web-api-event
tags:
- Document
- Event
- Reference
- Web
- pointerlockchange
browser-compat: api.Document.pointerlockchange_event
browser-compat: api.Element.pointerlockchange_event
---

{{APIRef}}

The `pointerlockchange` event is fired when the pointer is locked/unlocked.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
---
title: 'Document: pointerlockerror event'
slug: Web/API/Document/pointerlockerror_event
title: 'Element: pointerlockerror event'
slug: Web/API/Element/pointerlockerror_event
page-type: web-api-event
tags:
- Document
- Event
- Reference
- Web
- pointerlockerror
browser-compat: api.Document.pointerlockerror_event
browser-compat: api.Element.pointerlockerror_event
---

{{APIRef}}

The `pointerlockerror` event is fired when locking the pointer failed (for technical reasons or because the permission was denied).
Expand Down
2 changes: 1 addition & 1 deletion files/en-us/web/api/element/requestpointerlock/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ The **`Element.requestPointerLock()`** method lets you
asynchronously ask for the pointer to be locked on the given element.

To track the success or failure of the request, it is necessary to listen for the
{{domxref("Document/pointerlockchange_event", "pointerlockchange")}} and {{domxref("Document/pointerlockerror_event", "pointerlockerror")}} events at the
{{domxref("Element/pointerlockchange_event", "pointerlockchange")}} and {{domxref("Element/pointerlockerror_event", "pointerlockerror")}} events at the
{{domxref("Document")}} level.

## Syntax
Expand Down
6 changes: 3 additions & 3 deletions files/en-us/web/api/pointer_lock_api/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ if (document.pointerLockElement === canvas ||
}
```

The {{domxref("Document.exitPointerLock()")}} method is used to exit pointer lock, and like {{domxref("Element.requestPointerLock","requestPointerLock")}}, works asynchronously using the {{domxref("Document/pointerlockchange_event", "pointerlockchange")}} and {{domxref("Document/pointerlockerror_event", "pointerlockerror")}} events, which you'll see more about below.
The {{domxref("Document.exitPointerLock()")}} method is used to exit pointer lock, and like {{domxref("Element.requestPointerLock","requestPointerLock")}}, works asynchronously using the {{domxref("Element/pointerlockchange_event", "pointerlockchange")}} and {{domxref("Element/pointerlockerror_event", "pointerlockerror")}} events, which you'll see more about below.

```js
document.exitPointerLock = document.exitPointerLock ||
Expand All @@ -75,7 +75,7 @@ document.exitPointerLock();

## pointerlockchange event

When the Pointer lock state changes—for example, when calling {{domxref("Element.requestPointerLock","requestPointerLock()")}}, {{domxref("Document.exitPointerLock","exitPointerLock()")}}, the user pressing the ESC key, etc.—the {{domxref("Document/pointerlockchange_event", "pointerlockchange")}} event is dispatched to the `document`. This is a simple event and contains no extra data.
When the Pointer lock state changes—for example, when calling {{domxref("Element.requestPointerLock","requestPointerLock()")}}, {{domxref("Document.exitPointerLock","exitPointerLock()")}}, the user pressing the ESC key, etc.—the {{domxref("Element/pointerlockchange_event", "pointerlockchange")}} event is dispatched to the `document`. This is a simple event and contains no extra data.

```js
if ("onpointerlockchange" in document) {
Expand All @@ -98,7 +98,7 @@ function lockChangeAlert() {

## pointerlockerror event

When there is an error caused by calling {{domxref("Element.requestPointerLock","requestPointerLock()")}} or {{domxref("Document.exitPointerLock","exitPointerLock()")}}, the {{domxref("Document/pointerlockerror_event", "pointerlockerror")}} event is dispatched to the `document`. This is a simple event and contains no extra data.
When there is an error caused by calling {{domxref("Element.requestPointerLock","requestPointerLock()")}} or {{domxref("Document.exitPointerLock","exitPointerLock()")}}, the {{domxref("Element/pointerlockerror_event", "pointerlockerror")}} event is dispatched to the `document`. This is a simple event and contains no extra data.

```js
document.addEventListener('pointerlockerror', lockError, false);
Expand Down
4 changes: 2 additions & 2 deletions files/en-us/web/events/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -922,8 +922,6 @@ This section lists events that have _their own_ reference pages on MDN. If you a
- [pointerdown event](/en-US/docs/Web/API/Document/pointerdown_event)
- [pointerenter event](/en-US/docs/Web/API/Document/pointerenter_event)
- [pointerleave event](/en-US/docs/Web/API/Document/pointerleave_event)
- [pointerlockchange event](/en-US/docs/Web/API/Document/pointerlockchange_event)
- [pointerlockerror event](/en-US/docs/Web/API/Document/pointerlockerror_event)
- [pointermove event](/en-US/docs/Web/API/Document/pointermove_event)
- [pointerout event](/en-US/docs/Web/API/Document/pointerout_event)
- [pointerover event](/en-US/docs/Web/API/Document/pointerover_event)
Expand Down Expand Up @@ -988,6 +986,8 @@ This section lists events that have _their own_ reference pages on MDN. If you a
- [MSInertiaStart event](/en-US/docs/Web/API/Element/MSInertiaStart_event)
- [MSManipulationStateChanged event](/en-US/docs/Web/API/Element/MSManipulationStateChanged_event)
- [paste event](/en-US/docs/Web/API/Element/paste_event)
- [pointerlockchange event](/en-US/docs/Web/API/Element/pointerlockchange_event)
- [pointerlockerror event](/en-US/docs/Web/API/Element/pointerlockerror_event)
- [scroll event](/en-US/docs/Web/API/Element/scroll_event)
- [select event](/en-US/docs/Web/API/Element/select_event)
- [show event](/en-US/docs/Web/API/Element/show_event)
Expand Down
2 changes: 1 addition & 1 deletion files/jsondata/GroupData.json
Original file line number Diff line number Diff line change
Expand Up @@ -1026,7 +1026,7 @@
"interfaces": [],
"methods": ["Element.requestPointerLock()", "Document.exitPointerLock()"],
"properties": ["Document.pointerLockElement"],
"events": ["Document: pointerlockchange", "Document: pointerlockerror"]
"events": ["Element: pointerlockchange", "Element: pointerlockerror"]
},
"Presentation API": {
"overview": ["Presentation API"],
Expand Down

0 comments on commit 9c4fcf7

Please sign in to comment.