Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: capricorn86/happy-dom
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v13.8.1
Choose a base ref
...
head repository: capricorn86/happy-dom
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 4970c699d07d97c4a9839e25c831eef230445abf
Choose a head ref
  • 2 commits
  • 2 files changed
  • 1 contributor

Commits on Mar 12, 2024

  1. fix: [#1043] Adds deprecated keyCode property to KeyboardEvent

    capricorn86 committed Mar 12, 2024
    Copy the full SHA
    01ca3ca View commit details
  2. Merge pull request #1301 from capricorn86/1043-not-being-able-to-set-…

    …a-keycode-for-a-keyboardevent
    
    fix: [#1043] Adds deprecated keyCode property to KeyboardEvent
    capricorn86 authored Mar 12, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    4970c69 View commit details
Showing with 11 additions and 0 deletions.
  1. +5 −0 packages/happy-dom/src/event/events/IKeyboardEventInit.ts
  2. +6 −0 packages/happy-dom/src/event/events/KeyboardEvent.ts
5 changes: 5 additions & 0 deletions packages/happy-dom/src/event/events/IKeyboardEventInit.ts
Original file line number Diff line number Diff line change
@@ -10,4 +10,9 @@ export default interface IKeyboardEventInit extends IUIEventInit {
metaKey?: boolean;
repeat?: boolean;
isComposing?: boolean;

/**
* @deprecated
*/
keyCode?: number;
}
6 changes: 6 additions & 0 deletions packages/happy-dom/src/event/events/KeyboardEvent.ts
Original file line number Diff line number Diff line change
@@ -19,6 +19,11 @@ export default class KeyboardEvent extends UIEvent {
public readonly repeat: boolean;
public readonly shiftKey: boolean;

/**
* @deprecated
*/
public readonly keyCode: number;

/**
* Constructor.
*
@@ -37,5 +42,6 @@ export default class KeyboardEvent extends UIEvent {
this.metaKey = eventInit?.metaKey ?? false;
this.repeat = eventInit?.repeat ?? false;
this.shiftKey = eventInit?.shiftKey ?? false;
this.keyCode = eventInit?.keyCode ?? 0;
}
}