Re: Empty text node in DOM tree
Martijn <[email protected]>
| Newsgroups | gmane.comp.mozilla.devel.dom |
|---|---|
| Message-ID | <[email protected]> |
This is parsing of tag soup html. I guess html5 parsing is covering this/will cover this: http://www.whatwg.org/specs/web-apps/current-work/multipage/section-parsing.html In any case, Firefox should probably do what IE does in this case, I guess, unless there's a good reason not to. Regards, Martijn On 1/10/08, [email protected] <[email protected]> wrote: > I noticed that after Mozilla loads a document, it creates empty text > node between tags that have new line character in between. A lot of > other DOM applications do the same thing. However, the problem in > Mozilla case is this behavior is a bit random, at least from my point > of view. Here is a simple HTML: > > <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http:// > www.w3.org/TR/html4/loose.dtd"> > <html> > <head> > <meta http-equiv="Content-Type" content="text/html; > charset=ISO-8859-1"> > <title>Title here</title> > <style> > h1 { > color: blue; > } > </style> > </head> > <body> > <input type="hidden" name="test" value="1"> > <p>A paragraph</p> > </body> > </html> > > A logical guess will be Mozilla creates an empty text node per new > line between tags. The actual result is: there is always an empty text > node after <head> (even if the new line were removed between <head> > and <meta>; there is always no empty text node between <meta> and > <title> (even if I added spaces after <meta>); there is an empty text > node between <title> and <style>; under the <body> subtree, it seems > like there is one empty text node per new line, but I am not sure for > more complexed document. > > Does Mozilla treat tags differently regarding the new line between > them? Is there a specification for the parsing behavior? Appreciate if > someone can point me there. Thanks. > _______________________________________________ > dev-tech-dom mailing list > [email protected] > https://lists.mozilla.org/listinfo/dev-tech-dom > -- Martijn Wargers - Help Mozilla! http://weblogs.mozillazine.org/qa/ http://wiki.mozilla.org/Mozilla_QA_Community irc://irc.mozilla.org/qa - /nick mw22