Closed Bug 118213 Opened 23 years ago Closed 23 years ago

Mozilla should prune #text DOM nodes containing nothing but whitespace

Categories

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

defect
Not set
normal

Tracking

()

VERIFIED DUPLICATE of bug 26179

People

(Reporter: zwol, Assigned: jst)

Details

User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.7+) Gecko/20011228
BuildID:    2001122808

Mozilla currently generates tons of DOM #text nodes which contain nothing
but white space.  For instance, typical HTML like

<html><head></head>
<body>
<p>blah blah blah</p>
<p>another paragraph</p>
</body>
</html>

will generate five unnecessary #text nodes, one for each of the newline
markers.  This is easiest to see by loading up a simple page in the DOM
Inspector.  Compare the above with

<html><head></head><body><p>blah blah blah</p><p>another paragraph</p></body></html>

where everything is on a single line.

Mozilla should delete all leading and trailing whitespace from #text nodes
and then discard #text nodes which turn out to be empty.  This will give
the desirable property that the DOM tree for a document is independent of
where the author chose to break lines.  It should also save memory.
Known bug/issue.

*** This bug has been marked as a duplicate of 26179 ***
Status: UNCONFIRMED → RESOLVED
Closed: 23 years ago
Resolution: --- → DUPLICATE
verified
Status: RESOLVED → VERIFIED
Component: DOM: Core → DOM: Core & HTML
QA Contact: stummala → general
You need to log in before you can comment on or make changes to this bug.