Visit Mozilla.org

Talk:Whitespace in the DOM

From MDC

Moved from DOM:element.firstChild, doesn't really belong there. --Nickolay 16:09, 19 June 2006 (PDT)

[edit] Whitespace

More about the phantom nodes issue read at bug 26179 (do not comment in that bug!). One may format his code as shown below to work around the problem:

<!-- Conventional pretty-print currently
     leading to DOM Tree pollution in Gecko:
 -->
<div>
 <ul>
  <li>Position 1</li>
  <li>Position 2</li>
  <li>Position 3</li>
 </ul>
</div>

<!-- Pretty-print adjusted to the
     phantom nodes issue:
 -->
<div
 ><ul
  ><li>Position 1</li
  ><li>Position 2</li
  ><li>Position 3</li
 ></ul
></div>

I have moved the pretty-print workaround back to http://developer.mozilla.org/en/docs/Whitespace_in_the_DOM Thinking back, I see no reason why http://developer.mozilla.org/en/docs/Whitespace_in_the_DOM#Making_things_easier would be suitable for Javascript-based tree walker description but not for the common pretty print workaround. They are both solving the same problem and "making things easier".