Closed
Bug 283420
Opened 20 years ago
Closed 20 years ago
copy/paste of (CSS) white-space: pre; text differs from copy/paste of <pre> text
Categories
(Core :: DOM: Serializers, defect)
Tracking
()
RESOLVED
DUPLICATE
of bug 116083
People
(Reporter: peakle, Unassigned)
Details
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0
text (source code) displayed in browser that is in a <div style="white-space:
pre;"> block cannot be cleanly copied and pasted. When pasted, the whitespace
characters are stripped away so the paste result is formatted in a contiguous
block, without streams of whitespace -- paste result looks very different from
what was seen in browser. Same source code inside a <pre> tag block, on the
other hand, can be copied and pasted fine -- the paste carries forward all the
whitespace characters and pasted code is formatted just like what was seen in
the browser. I duplicated this in Mozilla 1.7.1 also. IE6 doesn't have this
problem.
Reproducible: Always
Steps to Reproduce:
1. See enclosed html file
2. Separately copy and paste each of the 3 blocks of source code from the
example into an editor.
3.
Actual Results:
pasted source code has most of the whitespace removed.
Expected Results:
make the paste result look like what I saw in the browser. white-space: pre
should work like <pre> tag in this respect.
HTML file that illustrates the problem:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>test</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
</head>
<body>
<div style="white-space: pre;">
white-space: pre;
for (i = 0; i < anchors.length; i++) {
if ((anchors[i].className == "ln") || (anchors[i].className == "ln_hit")) {
savedAnchorValues[i] = anchors[i].firstChild.data;
anchors[i].removeChild(anchors[i].firstChild);
}
}
</div>
<div style="white-space: pre;">
white-space: pre; with <br/> at end of each line:
for (i = 0; i < anchors.length; i++) {<br/>
if ((anchors[i].className == "ln") || (anchors[i].className ==
"ln_hit")) {<br/>
savedAnchorValues[i] = anchors[i].firstChild.data;<br/>
anchors[i].removeChild(anchors[i].firstChild);
}<br/>
}<br/>
</div>
<div>
<pre>
<pre> tag:
for (i = 0; i < anchors.length; i++) {
if ((anchors[i].className == "ln") || (anchors[i].className == "ln_hit")) {
savedAnchorValues[i] = anchors[i].firstChild.data;
anchors[i].removeChild(anchors[i].firstChild);
}
}
</pre>
</div>
</body>
</html>
Comment 1•20 years ago
|
||
Dupe of 116083?
Assignee: firefox → dom-to-text
Component: General → DOM to Text Conversion
Product: Firefox → Core
QA Contact: general
Version: unspecified → Trunk
Comment 2•20 years ago
|
||
*** This bug has been marked as a duplicate of 116083 ***
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•