Skip to content

Commit

Permalink
Support empty string for maxlength
Browse files Browse the repository at this point in the history
An input's maxlength can be an empty string, which should NOT limit typing.
  • Loading branch information
Aprillion committed Mar 18, 2021
1 parent 0ffb5f3 commit 83731e7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/utils/edit/calculateNewValue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export function calculateNewValue(

// can't use .maxLength property because of a jsdom bug:
// https://github.com/jsdom/jsdom/issues/2927
const maxLength = Number(element.getAttribute('maxlength') ?? -1)
const maxLength = Number(element.getAttribute('maxlength') || -1)

let newValue: string, newSelectionStart: number

Expand Down

0 comments on commit 83731e7

Please sign in to comment.