WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED DUPLICATE of
bug 120030
229553
input "maxlength" attribute counts grapheme clusters rather than code units
https://bugs.webkit.org/show_bug.cgi?id=229553
Summary
input "maxlength" attribute counts grapheme clusters rather than code units
Takao Baba
Reported
2021-08-26 06:23:20 PDT
Created
attachment 436503
[details]
screenshot Steps to reproduce: 1. Open
https://jsbin.com/pujuyizuze/1/edit?html,output
2. Enter "π¨βπ¨βπ¦". * Note: This is a character of one grapheme cluster, but has five Unicode code points (Man/ZWJ/Man/ZWJ/Boy). The "length" of this character is "8". Expected behavior: Just "π¨β" is pasted, then no more characters can be added. Actual behavior: Entire "π¨βπ¨βπ¦" is pasted. Furthermore, totally three "π¨βπ¨βπ¦" character can be input. As the spec described, "maxlength" must address the "length", in other words "16-bit integers". Using grapheme cluster is incorrect.
https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#attr-fe-maxlength
> The "number of characters" is measured using length
https://infra.spec.whatwg.org/#string-length
> A stringβs length is the number of code units it contains.
Other browsers such as Chrome, Firefox and Edge work correct.
Attachments
screenshot
(146.45 KB, image/png)
2021-08-26 06:23 PDT
,
Takao Baba
no flags
Details
View All
Add attachment
proposed patch, testcase, etc.
Alexey Proskuryakov
Comment 1
2021-08-26 17:11:31 PDT
This is intentional behavior, and changing it would be user hostile. Perhaps we need to follow up on standard changes mentioned in
bug 120030
. *** This bug has been marked as a duplicate of
bug 120030
***
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug