01-19-2005, 08:48 AM
This works for me in IE6, but not FF1.0:
(Alert! This question is cross posted here :
but an answer doesn't seem to be forthcoming.)
// End hiding -->
It will work in Moz also if you remove the empty space like this:
<div id="d1">text1</div><div id="d2">text2</div>
The problem is that Moz (otherwise a correct interpretation) sees the possible textNode (even if an empty space)as the nextSibling, not the next <div> (as IE does)
Search the Forum for a code (I remeber I've seen it somewere) to "remove" empty spaces for Moz.
Or use the reference by tag name rather than firstChild or nextSibling...
01-19-2005, 01:12 PM
Someone on the other forum posted what the problem was: Moz sees a carriage return between two <divs> like this:
<div>some text</div>(invisible carriage return)
so the nextSibling of the first <div> is a text node containing the invisible carriage return, which is a pretty ridiculous implementation in my opinion.
it is the same thing as I said, but in other words. No, it is not really a silly implementation, it is an exact implementation of w3c recomandations. Moz keeps the ideea that before each tag child of a parent may be inserted a textNode, thus the order is
This case, you see that parent.firstChild is the textNode0, not the tagChild0, even if the textNode is empty (in fact an empty space) . The same with parent.tagChild0.nextSibling, which is textNode1, not tagChild1, even if the textNode is empty.
Spurious text node generation preserves indentation in the DOM representation. Try serializing a DOM in IE, then do the same thing in Mozilla. You'll notice Mozilla's is actually readable.
01-19-2005, 06:14 PM
Here's the code to get rid of them, if you need to -- http://www.codingforums.com/showthread.php?t=7028http://www.codingforums.com/showthread.php?t=7028