Closed
Bug 65857
Opened 24 years ago
Closed 24 years ago
trailing whitespaces confuse form field value
Categories
(Core :: DOM: Editor, defect, P3)
Core
DOM: Editor
Tracking
()
VERIFIED
FIXED
mozilla0.8
People
(Reporter: wo, Assigned: kinmoz)
Details
(Keywords: testcase)
Attachments
(2 files)
(deleted),
text/html
|
Details | |
(deleted),
patch
|
Details | Diff | Splinter Review |
When you have a text field whose value ends with two whitespaces, assigning that
same value with one of the whitespaces removed has no effect. That is, after the
assignment, the value still ends with two whitespaces.
This only happens with exactly *two* whitespaces.
Here is a testcase: (in the alert box the whitespaces are displayed as
exclamation marks)
<form>
<input type="text" value="thisisfollowedbytwospaces " size="50">
<input type="button" onclick="trim()" value="shorten">
</form>
<script>
function trim() {
w=document.forms[0].elements[0].value;
w2=w.substring(0, w.length-1);
document.forms[0].elements[0].value=w2;
w3=document.forms[0].elements[0].value;
alert(w2.replace(/ /g, '!')+" was assigned to form field.\n"
+"form field value now: "+w3.replace(/ /g, '!'));
}
</script>
this can be dangerous because it can cause infinite loops when you recursively
chop the last character of the field - as soon as two whitespaces are reached,
the recursion will never halt.
Reporter | ||
Comment 1•24 years ago
|
||
Comment 2•24 years ago
|
||
Confirmed
Platform: PC
OS: Windows 98
Mozilla Build: 2001011704
Marking NEW.
Severity: normal → major
Status: UNCONFIRMED → NEW
Ever confirmed: true
Keywords: testcase
OS: Windows 98 → All
Hardware: PC → All
Comment 3•24 years ago
|
||
Looks like this is an editor problem, the correct strings are passed into the
editor in the form control but when the value is requested from the edito in the
form control again it's not the value that was passed to it earlier (i.e. the
last whitespace was not chopped off). Reassigning.
Assignee: jst → beppe
Component: DOM Level 0 → Editor
QA Contact: desale → sujay
Comment 4•24 years ago
|
||
assigning to kin for initial eval, also adding jfrancis and akkana
Assignee: beppe → kin
Severity: major → normal
Priority: -- → P3
Comment 5•24 years ago
|
||
I guess this is truly the bug from outer space.
I did a quick look in the debugger and it looks like the mPreformatted flag in
the encoder is not being set so we fall into the code that thinks it is writing
out HTML since the start and end parent in the range being processed is a DIV.
Status: NEW → ASSIGNED
Target Milestone: --- → mozilla0.8
I just attatched a patch that fixes this bug. Can I get an r= from either akkana
or jfrancis and a super review from sfraser?
Comment 9•24 years ago
|
||
Yes, that makes much more sense than what it was doing before. r=akkana.
Comment 10•24 years ago
|
||
sr=sfraser
Assignee | ||
Comment 11•24 years ago
|
||
Fix checked into TRUNK:
mozilla/layout/html/forms/src/nsGfxTextControlFrame2.cpp revision 1.121
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
Whiteboard: FIX IN HAND
You need to log in
before you can comment on or make changes to this bug.
Description
•