Closed
Bug 560188
Opened 15 years ago
Closed 15 years ago
Single line text controls should not replace line breaks by white spaces but should strip them instead
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
DUPLICATE
of bug 549475
People
(Reporter: mounir, Assigned: mounir)
References
()
Details
Attachments
(1 obsolete file)
At the moment, single line text controls (<input type="{email,url,text,telephone,search}") prevents the user to insert line breaks from the UI but they will change the line breaks by white spaces when setting the value from js (.value or @value).
There is no clear definition of the correct behavior in this case but considering in the UI, line breaks are ignored (practically that's like being stripped) and the value sanitizing algorithm need the line breaks to be stripped (for the email, url, text, telephone and search states), it would be consistent to have the line breaks stripped instead of changed in white spaces when setting from js.
Actually, to be exact, the line breaks are not always changed in white spaces. That is handled by "nsTextEditRules::HandleNewLines(value, -1);". -1 means it should use "editor.singleLine.pasteNewlines" value.
Assignee | ||
Comment 1•15 years ago
|
||
I'm asking a review from Boris because he is a DOM and layout peer but if anyone else have any comment about this bug (is it reasonable or not?) it would be really appreciated.
Assignee: nobody → mounir.lamouri
Status: NEW → ASSIGNED
Attachment #439899 -
Flags: review?(bzbarsky)
![]() |
||
Comment 2•15 years ago
|
||
Comment on attachment 439899 [details] [diff] [review]
Patch v1
> There is no clear definition of the correct behavior in this case
Bug 549475 claims there is, with link to spec text.
This looks like a duplicate of that bug to me, but in any case punting review over to Ehsan, since he's been in this code recently.
Attachment #439899 -
Flags: review?(bzbarsky) → review?(ehsan)
Comment 3•15 years ago
|
||
Yes, this is a dupe of bug 549475.
Note that the HTML5 spec only specifies the value sanitization algorithm for text and search inputs, and according to the spec, we shouldn't really touch the newlines inside other types of input fields. Of course, for example, an email address cannot have a newline character, but we shouldn't be removing it, we should just treat the value as an invalid email address. Ditto for other types of HTML5 form elements.
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → DUPLICATE
Updated•15 years ago
|
Attachment #439899 -
Attachment is obsolete: true
Attachment #439899 -
Flags: review?(ehsan)
You need to log in
before you can comment on or make changes to this bug.
Description
•