Re: childNodes.length IE and FF difference
- From: RobG <rgqld@xxxxxxxxxxxx>
- Date: Wed, 17 May 2006 23:33:41 GMT
Ian Collins wrote:
Michael Winter wrote:[...]
As Firefox doesn't typically use a validating XML processor, white spaceI think that's the cause of the difference, IE parses XML as HTML thus
in element content will be treated simply as character data, and the DOM
Core Level 2 specification states in the introductory section, "What the
Document Object Model is":
Note: There may be some variations depending on the parser
being used to build the DOM. For instance, the DOM may not
contain whitespaces in element content if the parser discards
them.
So, conversely, if the parser does pass on white space characters (and
we've established that it may), the document tree may contain the text
nodes that Fx includes.
With applications of SGML, the situation is different as there are rules
for collapsing white space and ignoring line terminators after start
tags and before end tags. White space in element content may also need
to be ignored, but as I don't have a copy of the SGML specification, I
couldn't say for certain.
collapses the whitespace.
Is that an excuse? I thought the HTML specification dealt with white space from the perspective of presentation, not a DOM.
For example, some written languages require that all white space is removed and others do not so it would be silly to remove it from the DOM depending on the language used.
I thought that whitespace should be preserved because if CSS is to be used to display content, you can't remove whitespace (other than collapsing it) that might be required by CSS, so better to preserve it and let CSS do its thing.
There is a concept of treating white space in block and inline elements differently, but CSS block elements can become inline and vice versa, so again at the DOM level it would be silly to remove whitespace based on a node being a block element when it might be later changed to inline (or some other display attribute value).
--
Rob
Group FAQ: <URL:http://www.jibbering.com/faq/>
.
- References:
- childNodes.length IE and FF difference
- From: Q1tum
- Re: childNodes.length IE and FF difference
- From: Ian Collins
- Re: childNodes.length IE and FF difference
- From: Q1tum
- Re: childNodes.length IE and FF difference
- From: Ian Collins
- Re: childNodes.length IE and FF difference
- From: VK
- Re: childNodes.length IE and FF difference
- From: Michael Winter
- Re: childNodes.length IE and FF difference
- From: Ian Collins
- childNodes.length IE and FF difference
- Prev by Date: Re: changing css bu javascript for all input boxes with the same name
- Next by Date: Re: Error: document.getElementsByName(userid)[0] has no properties
- Previous by thread: Re: childNodes.length IE and FF difference
- Next by thread: Re: childNodes.length IE and FF difference
- Index(es):
Relevant Pages
|