Closed Bug 147489 Opened 19 years ago Closed 19 years ago

HTML "Whitespace" siblings of block-level elements should be deleted.

Categories

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

defect
Not set
major

Tracking

()

VERIFIED DUPLICATE of bug 26179

People

(Reporter: lapsap7+mz, Assigned: jst)

Details

From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0rc3)
Gecko/20020523
BuildID:    20020523

In W3C DOM specification at the following URL:
http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/introduction.html#ID-E7C30821

we're given an example tree structure and a corresponding tree structure diagram:
<TABLE>
<TBODY>
<TR>
<TD>Shady Grove</TD>
<TD>Aeolian</TD>
</TR>
<TR>
<TD>Over the River, Charlie</TD>
<TD>Dorian</TD>
</TR>
</TBODY>
</TABLE>

However, if you use DOM inspector to look at this, you could find that there're
a lot of #text node siblings, eg between <td> nodes.  Let's see two other
situations:
1)
Case 1:
<div>Block 1</div>
<div>Block 2</div>

Case 2:
<div>Block 1</div><div>Block 2</div>

2)
Case 1:
<ul>
  <li>List 1</li> <li>List 2</li>
</ul>

Case 2:
<ul>
  <li>List 1<li>List 2
</ul>
_________________________________________________

In both Case 1, there's a #text sibling between those two <div> nodes and <li>
nodes, which are both block-level elements.  Since this #text sibling is just a
"whitespace" sibling, and since both case 1 and case 2 are equivalent in both
situations, IMO, this "whitespace" sibling should be eliminated in the DOM.  By
"whitespace", I meant a combination of only whitespaces, tabs and newlines. 
Other than that, there're whitespace siblings before and after both <li>
elements in situation 2, and these siblings should be deleted too.

On the other hand, don't delete in-line elements' whitespace siblings, eg, the
one between <img> and <a> in this line:
<img ...> <a ...>...</a>

I'm filing another bug about eliminating XML whitespace siblings.  If you think
these two bugs are the same, please mark them as duplicate.


Reproducible: Always
The other bug I talked about is bug 147487

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