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

UNCONFIRMED
Unassigned

Status

()

Core
DOM: Core & HTML
UNCONFIRMED
11 years ago
4 years ago

People

(Reporter: Aapo Laitinen, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

11 years ago
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".
(Reporter)

Comment 1

11 years ago
Created attachment 268469 [details]
testcase

Updated

10 years ago
Component: DOM: HTML → DOM: Core & HTML

Comment 2

4 years ago
(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?
You need to log in before you can comment on or make changes to this bug.