Closed Bug 602163 Opened 11 years ago Closed 11 years ago

contenteditable div whose white-space style attribute has been set to pre-wrap is not properly editable.

Categories

(Core :: DOM: Editor, defect)

1.9.2 Branch
x86
Windows 7
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 592592

People

(Reporter: tgvrs_santhosh, Unassigned)

Details

(Keywords: testcase)

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.3 (KHTML, like Gecko) Chrome/6.0.472.63 Safari/534.3
Build Identifier: 4.0b6

contenteditable div containing pre tag is not properly editable.

for example, once the below html code is loaded in FF

<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN' 'http://www.w3.org/TR/html4/loose.dtd'>
<html>
<head>
    <title>attribute identifiers test</title>
    <script type="text/javascript">
    function sampleFunc()
    {
        var divElem = document.getElementById("sampleDiv");
        divElem.textContent = "Mozilla\n    \n    \nFirefox";
    }
    </script>
</head>
<body onload="sampleFunc()">
	    <div contenteditable="true" id="sampleDiv" style="white-space:pre-wrap;"></div>
</body>
</html>

As in the above html code, white-space:pre-wrap is set, it will respect the spaces and newline characters. so in div, so two lines will exist in between Mozilla and Firefox text. Now, makesure the indent selection is just before the Firefox Text. Now, click backspace, it will delete the entire two lines along with spaces. Now, it will be displayed as MozillaFirefox with out any spaces and line in between them.

Similarly, in the second line i have 4 spaces along with new line character. Now, just make sure that the indent selection is after the 4 spaces and press any alphanumeric key, it will displayed in the next line instead of in second line.

This is working fine in chrome.

Reproducible: Always

Steps to Reproduce:
for example, load the below piece of code in FF.

<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN' 'http://www.w3.org/TR/html4/loose.dtd'>
<html>
<head>
    <title>attribute identifiers test</title>
    <script type="text/javascript">
    function sampleFunc()
    {
        var divElem = document.getElementById("sampleDiv");
        divElem.textContent = "Mozilla\n    \n    \nFirefox";
    }
    </script>
</head>
<body onload="sampleFunc()">
	    <div contenteditable="true" id="sampleDiv" style="white-space:pre-wrap;"></div>
</body>
</html>

As in the above html code, white-space:pre-wrap is set, it will respect the spaces and newline characters. so in div, so two lines will exist in between Mozilla and Firefox text. Now, makesure the indent selection is just before the Firefox Text. Now, click backspace, it will delete the entire two lines along with spaces. Now, it will be displayed as MozillaFirefox with out any spaces and line in between them.

Similarly, in the second line i have 4 spaces along with new line character. Now, just make sure that the indent selection is after the 4 spaces and press any alphanumeric key, it will displayed in the next line instead of in second line.

This is working fine in chrome.
Actual Results:  
when backspace is pressed, it is deleting all the new lines in between Mozilla and Firefox Text.

when i press any alphanumeric key, it is displaying the character in next line.

Expected Results:  
It should delete only one line. it should not remove all the newline characters in between the text elements.

when alphanumeric key is pressed, it should display in the same line.
Summary: contenteditable div containing pre tag is not properly editable. → contenteditable div whose white-space style attribute has been set to pre-wrap is not properly editable.
Component: General → Editor
Product: Firefox → Core
QA Contact: general → editor
Attached file Reporter's Testcase
This is WFM on Trunk/Fx4 Beta. On 1.9.2 it's reproduceable.
Keywords: testcase
Version: unspecified → 1.9.2 Branch
XtC4UaLL, which 1.9.2 build did you test?  1.9.2.10, or a 1.9.2 nightly?  This looks a lot like bug 592592.
Ah right. Have been testing against 1.9.2.10.
It's WFM against http://hg.mozilla.org/releases/mozilla-1.9.2/rev/053f07027a38 (.11 Relbranch) and http://hg.mozilla.org/releases/mozilla-1.9.2/rev/334ef251eddd (Nightly). Thus duping this.
Status: UNCONFIRMED → RESOLVED
Closed: 11 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 592592
I would like to be able to hghlight white space and then hit an HTML button just so I could fix that bit.
Scrolling between panes is a pain and their are so many problems that this would provide a welcome patch.
You need to log in before you can comment on or make changes to this bug.