WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
74686
[Forms] The "maxlength" attribute on "textarea" tag miscounts hard newlines
https://bugs.webkit.org/show_bug.cgi?id=74686
Summary
[Forms] The "maxlength" attribute on "textarea" tag miscounts hard newlines
yosin
Reported
2011-12-15 22:38:22 PST
From Chromium
http://crbug.com/104971
== Steps == 1. Give a textarea tag a maxlength=10 2. Hit Enter key many times 3. Submit form containing textarea == Result == 10 CRLF pairs are submitted. == Expected == 5 CRLF pairs are submitted. == Note == According to WHATWG, line break characters in DOM are LF, and are CRLF in submission value.
Attachments
Patch 1
(7.38 KB, patch)
2011-12-16 00:24 PST
,
yosin
no flags
Details
Formatted Diff
Diff
Patch 2
(5.42 KB, patch)
2011-12-16 01:25 PST
,
yosin
no flags
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
yosin
Comment 1
2011-12-16 00:24:15 PST
Created
attachment 119578
[details]
Patch 1
Kent Tamura
Comment 2
2011-12-16 00:40:25 PST
Comment on
attachment 119578
[details]
Patch 1 View in context:
https://bugs.webkit.org/attachment.cgi?id=119578&action=review
> Source/WebCore/html/HTMLTextAreaElement.cpp:58 > +static unsigned computeLengthForSubmission(const String& str) > +{ > + unsigned count = numGraphemeClusters(str); > + unsigned len = str.length();
We prefer complete words for variable names. 'str' 'len' are not acceptable.
> LayoutTests/ChangeLog:10 > + * fast/forms/textarea/textarea-maxlength-newline-expected.txt: Added. > + * fast/forms/textarea/textarea-maxlength-newline.html: Added.
The new test is not needed. Your change for textarea-maxlength.js covers the behavior change.
yosin
Comment 3
2011-12-16 01:25:48 PST
Created
attachment 119584
[details]
Patch 2
Kent Tamura
Comment 4
2011-12-16 01:31:31 PST
Comment on
attachment 119584
[details]
Patch 2 ok
WebKit Review Bot
Comment 5
2011-12-16 02:48:20 PST
Comment on
attachment 119584
[details]
Patch 2 Clearing flags on attachment: 119584 Committed
r103051
: <
http://trac.webkit.org/changeset/103051
>
WebKit Review Bot
Comment 6
2011-12-16 02:48:24 PST
All reviewed patches have been landed. Closing bug.
Aaron Nance
Comment 7
2016-02-17 10:29:19 PST
This issue needs to be reopened. All hard carriage returns are being counted as 2 against the maxlength in Safari. I've tested this against Safari 9 on Mac 10.10 and in mobile Safari on iOS 9.2.
Zach Leatherman
Comment 8
2016-09-20 09:05:05 PDT
Per Boris Zbarsky’s comment on the Mozilla issue tracker, the specification was recently changed to make hard newlines represent a single character:
https://bugzilla.mozilla.org/show_bug.cgi?id=702296#c41
So, I think this needs to be reopened? Per research in
https://github.com/scottjehl/Device-Bugs/issues/73
only Chrome and Safari are going against the new spec. The original case report should be amended to read: == Expected == 10 CRLF pairs are submitted.
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