Open Bug 384557 Opened 14 years ago Updated 2 years ago

Line breaks in textarea's defaultValue are handled differently from those in value

Categories

(Core :: DOM: Core & HTML, defect, P5)

x86
Windows XP
defect

Tracking

()

UNCONFIRMED

People

(Reporter: aapo-bugzilla, Unassigned)

Details

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a6pre) Gecko/20070614 Minefield/3.0a6pre
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a6pre) Gecko/20070614 Minefield/3.0a6pre

When a string containing \r\n pairs is assigned to the "value" property of a "textarea" element, the line breaks are converted into \n. When the same string is assigned to the "defaultValue" property, the line breaks are not converted.

Reproducible: Always

Steps to Reproduce:
See attached testcase. Or try the following code snippet:

var elm = document.getElementById('myarea');
var some_str = 'Value\r\nset';
elm.value = some_str;
elm.defaultValue = some_str;
alert(elm.value == elm.defaultValue);
Actual Results:  
Alert saying "false".

Expected Results:  
Alert saying "true".
Attached file testcase
Component: DOM: HTML → DOM: Core & HTML
(In reply to Aapo Laitinen from comment #0)

> When a string containing \r\n pairs is assigned to the "value" property of a
> "textarea" element, the line breaks are converted into \n.

Whether it is a proper behavior?
https://bugzilla.mozilla.org/show_bug.cgi?id=1472046

Move all DOM bugs that haven’t been updated in more than 3 years and has no one currently assigned to P5.

If you have questions, please contact :mdaly.
Priority: -- → P5
You need to log in before you can comment on or make changes to this bug.