diff --git a/files/en-us/_redirects.txt b/files/en-us/_redirects.txt index 47e894400923418..244b4a6cb35eaa7 100644 --- a/files/en-us/_redirects.txt +++ b/files/en-us/_redirects.txt @@ -9242,7 +9242,7 @@ /en-US/docs/Web/API/KeyboardEvent.code /en-US/docs/Web/API/KeyboardEvent/code /en-US/docs/Web/API/KeyboardEvent.ctrlKey /en-US/docs/Web/API/KeyboardEvent/ctrlKey /en-US/docs/Web/API/KeyboardEvent.getModifierState /en-US/docs/Web/API/KeyboardEvent/getModifierState -/en-US/docs/Web/API/KeyboardEvent.initKeyEvent /en-US/docs/Web/API/KeyboardEvent/initKeyEvent +/en-US/docs/Web/API/KeyboardEvent.initKeyEvent /en-US/docs/Web/API/KeyboardEvent/KeyboardEvent /en-US/docs/Web/API/KeyboardEvent.initKeyboardEvent /en-US/docs/Web/API/KeyboardEvent/initKeyboardEvent /en-US/docs/Web/API/KeyboardEvent.isComposing /en-US/docs/Web/API/KeyboardEvent/isComposing /en-US/docs/Web/API/KeyboardEvent.key /en-US/docs/Web/API/KeyboardEvent/key @@ -9252,6 +9252,7 @@ /en-US/docs/Web/API/KeyboardEvent.shiftKey /en-US/docs/Web/API/KeyboardEvent/shiftKey /en-US/docs/Web/API/KeyboardEvent.which /en-US/docs/Web/API/UIEvent/which /en-US/docs/Web/API/KeyboardEvent/code/code_values /en-US/docs/Web/API/UI_Events/Keyboard_event_code_values +/en-US/docs/Web/API/KeyboardEvent/initKeyEvent /en-US/docs/Web/API/KeyboardEvent/KeyboardEvent /en-US/docs/Web/API/KeyboardEvent/key/Key_Values /en-US/docs/Web/API/UI_Events/Keyboard_event_key_values /en-US/docs/Web/API/KeyboardEvent/which /en-US/docs/Web/API/UIEvent/which /en-US/docs/Web/API/KeyframeEffect/KeyframeEffect.getKeyframes() /en-US/docs/Web/API/KeyframeEffect/getKeyframes @@ -11058,7 +11059,7 @@ /en-US/docs/Web/API/event.eventPhase /en-US/docs/Web/API/Event/eventPhase /en-US/docs/Web/API/event.explicitOriginalTarget /en-US/docs/Web/API/Event/explicitOriginalTarget /en-US/docs/Web/API/event.initEvent /en-US/docs/Web/API/Event/initEvent -/en-US/docs/Web/API/event.initKeyEvent /en-US/docs/Web/API/KeyboardEvent/initKeyEvent +/en-US/docs/Web/API/event.initKeyEvent /en-US/docs/Web/API/KeyboardEvent/KeyboardEvent /en-US/docs/Web/API/event.initMouseEvent /en-US/docs/Web/API/MouseEvent/initMouseEvent /en-US/docs/Web/API/event.initUIEvent /en-US/docs/Web/API/UIEvent/initUIEvent /en-US/docs/Web/API/event.isTrusted /en-US/docs/Web/API/Event/isTrusted diff --git a/files/en-us/_wikihistory.json b/files/en-us/_wikihistory.json index 2126b1f01463696..012eb3d5a5757fe 100644 --- a/files/en-us/_wikihistory.json +++ b/files/en-us/_wikihistory.json @@ -43922,27 +43922,6 @@ "Masayuki" ] }, - "Web/API/KeyboardEvent/initKeyEvent": { - "modified": "2019-03-24T00:10:53.315Z", - "contributors": [ - "mfluehr", - "fscholz", - "Noitidart", - "teoli", - "MHasan", - "willlma", - "kscarfone", - "Sheppy", - "mcomella", - "Jorend", - "Nickolay", - "Ynvich", - "Ptak82", - "Mgjbot", - "DBaron", - "Gary.johnson.53" - ] - }, "Web/API/KeyboardEvent/initKeyboardEvent": { "modified": "2019-03-23T23:04:44.260Z", "contributors": ["mfluehr", "wbamberg", "fscholz", "teoli"] diff --git a/files/en-us/mozilla/firefox/releases/93/index.md b/files/en-us/mozilla/firefox/releases/93/index.md index 04598a73e86a2ed..6e5b2e3695fda2d 100644 --- a/files/en-us/mozilla/firefox/releases/93/index.md +++ b/files/en-us/mozilla/firefox/releases/93/index.md @@ -48,7 +48,7 @@ This article provides information about the changes in Firefox 93 that will affe #### Removals -- {{domxref("KeyboardEvent.initKeyEvent()")}} has been moved behind the preference `dom.keyboardevent.init_key_event.enabled` and is disabled by default. +- `KeyboardEvent.initKeyEvent()` has been moved behind the preference `dom.keyboardevent.init_key_event.enabled` and is disabled by default. The method is not present in any current specification or supported in other current browsers ([Firefox bug 1717760](https://bugzil.la/1717760)). ### WebDriver conformance (Marionette) diff --git a/files/en-us/web/api/keyboardevent/index.md b/files/en-us/web/api/keyboardevent/index.md index ec718deabff21a8..685dc6c1d31b487 100644 --- a/files/en-us/web/api/keyboardevent/index.md +++ b/files/en-us/web/api/keyboardevent/index.md @@ -161,8 +161,6 @@ _This interface also inherits methods of its parents, {{domxref("UIEvent")}} and ### Obsolete methods -- {{domxref("KeyboardEvent.initKeyEvent()")}} {{deprecated_inline}} - - : Initializes a `KeyboardEvent` object. This was implemented only by Firefox, and is no longer supported even there; instead, you should use the {{domxref("KeyboardEvent.KeyboardEvent", "KeyboardEvent()")}} constructor. - {{domxref("KeyboardEvent.initKeyboardEvent()")}} {{deprecated_inline}} - : Initializes a `KeyboardEvent` object. This is now deprecated. You should instead use the {{domxref("KeyboardEvent.KeyboardEvent", "KeyboardEvent()")}} constructor. @@ -268,7 +266,7 @@ document.addEventListener( {{Specifications}} -The `KeyboardEvent` interface specification went through numerous draft versions, first under DOM Events Level 2 where it was dropped as no consensus arose, then under DOM Events Level 3. This led to the implementation of non-standard initialization methods, the early DOM Events Level 2 version, {{domxref("KeyboardEvent.initKeyEvent()")}} by Gecko browsers and the early DOM Events Level 3 version, {{domxref("KeyboardEvent.initKeyboardEvent()")}} by others. Both have been superseded by the modern usage of a constructor: {{domxref("KeyboardEvent.KeyboardEvent", "KeyboardEvent()")}}. +The `KeyboardEvent` interface specification went through numerous draft versions, first under DOM Events Level 2 where it was dropped as no consensus arose, then under DOM Events Level 3. This led to the implementation of non-standard initialization methods, the early DOM Events Level 2 version, `KeyboardEvent.initKeyEvent()` by Gecko browsers and the early DOM Events Level 3 version, {{domxref("KeyboardEvent.initKeyboardEvent()")}} by others. Both have been superseded by the modern usage of a constructor: {{domxref("KeyboardEvent.KeyboardEvent", "KeyboardEvent()")}}. ## Browser compatibility diff --git a/files/en-us/web/api/keyboardevent/initkeyboardevent/index.md b/files/en-us/web/api/keyboardevent/initkeyboardevent/index.md index 7afd2083922a9aa..f51ba0e931819d7 100644 --- a/files/en-us/web/api/keyboardevent/initkeyboardevent/index.md +++ b/files/en-us/web/api/keyboardevent/initkeyboardevent/index.md @@ -56,7 +56,7 @@ None ({{jsxref("undefined")}}). {{Specifications}} -The `KeyboardEvent` interface specification went through numerous draft versions, first under DOM Events Level 2 where it was dropped as no consensus arose, then under DOM Events Level 3. This led to the implementation of non-standard initialization methods, the early DOM Events Level 2 version, {{domxref("KeyboardEvent.initKeyEvent()")}} by Gecko browsers and the early DOM Events Level 3 version, `KeyboardEvent.initKeyboardEvent()` by others. Both have been superseded by the modern usage of a constructor: {{domxref("KeyboardEvent.KeyboardEvent", "KeyboardEvent()")}}. +The `KeyboardEvent` interface specification went through numerous draft versions, first under DOM Events Level 2 where it was dropped as no consensus arose, then under DOM Events Level 3. This led to the implementation of non-standard initialization methods, the early DOM Events Level 2 version, `KeyboardEvent.initKeyEvent()` by Gecko browsers and the early DOM Events Level 3 version, `KeyboardEvent.initKeyboardEvent()` by others. Both have been superseded by the modern usage of a constructor: {{domxref("KeyboardEvent.KeyboardEvent", "KeyboardEvent()")}}. ## Browser compatibility diff --git a/files/en-us/web/api/keyboardevent/initkeyevent/index.md b/files/en-us/web/api/keyboardevent/initkeyevent/index.md deleted file mode 100644 index 20ccc9b19b1be2c..000000000000000 --- a/files/en-us/web/api/keyboardevent/initkeyevent/index.md +++ /dev/null @@ -1,94 +0,0 @@ ---- -title: "KeyboardEvent: initKeyEvent() method" -short-title: initKeyEvent() -slug: Web/API/KeyboardEvent/initKeyEvent -page-type: web-api-instance-method -status: - - deprecated - - non-standard ---- - -{{APIRef("UI Events")}} - -> [!WARNING] -> Do NOT use this method; Use the {{domxref("KeyboardEvent.KeyboardEvent", "KeyboardEvent()")}} constructor instead! -> -> The method has been removed from the DOM specification and is not supported by any current browser. -> Firefox hides this method behind the preference (`dom.keyboardevent.init_key_event.enabled`) from version 93 and plans to remove it shortly afterwards. - -{{deprecated_header}} - -The **`KeyboardEvent.initKeyEvent()`** method is used to -initialize the value of an event created using -{{domxref("document.createEvent")}} `("KeyboardEvent")`. Events initialized in -this way must have been created with the -{{domxref("document.createEvent")}} `("KeyboardEvent")` method. -`initKeyEvent()` must be called to set the event before it is [dispatched](/en-US/docs/Web/API/EventTarget/dispatchEvent). - -## Syntax - -```js-nolint -initKeyEvent(type, bubbles, cancelable, view, - ctrlKey, altKey, shiftKey, metaKey, - keyCode, charCode) -``` - -### Parameters - -- `type` - - : A string representing the type of event. -- `bubbles` - - : A boolean value indicating whether the event should bubble up through the - event chain or not (see [bubbles](/en-US/docs/Web/API/Event/bubbles)). -- `cancelable` - - : A boolean value indicating whether the event can be canceled (see [cancelable](/en-US/docs/Web/API/Event/cancelable)). -- `view` - - : Specifies the {{domxref("UIEvent.view")}}; this value may be `null`. -- `ctrlKey` - - : A boolean value that is `true` if the virtual key to be - generated is a combination of keys containing the Ctrl key. -- `altKey` - - : A boolean value that is `true` if the virtual key to be - generated is a combination of keys containing the Alt key. -- `shiftKey` - - : A boolean value that is `true` if the virtual key to be generated - is a combination of keys containing the Shiftkey. -- `metaKey` - - : A boolean value that is `true` if the virtual key to be - generated is a combination of keys containing the Meta key. -- `keyCode` - - : An `unsigned long` representing the virtual key code value of the key - which was pressed, otherwise `0`. See {{domxref("KeyboardEvent.keyCode")}} for the list of key codes. -- `charCode` - - : An `unsigned long` representing the Unicode character associated with - the pressed key otherwise `0`. - -### Return value - -None ({{jsxref("undefined")}}). - -## Examples - -```js -const event = document.createEvent("KeyboardEvent"); // create a key event -// define the event -event.initKeyEvent( - "keypress", // typeArg, - true, // canBubbleArg, - true, // cancelableArg, - null, // viewArg, Specifies UIEvent.view. This value may be null. - false, // ctrlKeyArg, - false, // altKeyArg, - false, // shiftKeyArg, - false, // metaKeyArg, - 9, // keyCodeArg, - 0, -); // charCodeArg); - -document.getElementById("blah").dispatchEvent(event); -``` - -## Specifications - -This implementation of keyboard events is based on the key events spec in the [early versions of DOM 2 Events](https://www.w3.org/TR/1999/WD-DOM-Level-2-19990923/events.html), later removed from that spec in favor of -{{domxref("KeyboardEvent.KeyboardEvent", "KeyboardEvent()")}} that should be used instead.