Re: InnerHTML not grabbing entire HTML if <p> is present
- From: Lasse Reichstein Nielsen <lrn@xxxxxxxxxx>
- Date: Wed, 29 Mar 2006 00:02:21 +0200
"MaryA" <arrowood@xxxxxxxxxxx> writes:
It is just sitting in an HTML document.
Well it's not an HTML document then, since it doesn't follow the
DTD of any version of HTML. The parser appears to parse it as
"tag soup", with gratuitous amounts of error correction. It's
anybody's guess how each browser will treat non-standard codes.
It is written at the bottom of document, for now. I have to find a
way to hid it and still be able to access it.
IE supports "XML islands" inside (otherwise) HTML documents. Other
browsers doesn't. Why use XML at all? If you want to access it with
Javascript anyway, you could just create a Javascript representation
of the data directly (e.g., using a JSON library on the server).
If I put it in as a comment, the getElementById does not find it.
Obviously, since it's not elements in the DOM any more.
I was under the impression that the DOM standard can be used to
access XML and HTML.
The DOM standard doesn't care what the element names of the document
are. The parser that processes the character sequence and turns it
into DOM elements do, since it is expecting HTML. HTML have specific
rules about which elements can be children of which other
elements. E.g., a div element cannot be the child of a paragraph (p)
element. Parsers attempts to be nice to you by accepting any tag
soup, and then do error correction on the document to try to make
it into a valid HTML document. This includes ending elements where
necessary, so the invalid HTML:
<p>lala<div>didi</div>lala</p>
is read as:
<p>lala</p><div>didi</div>lala
where all tags occour in an allowed order.
You are using non-HTML tags. The parser is, understandably, confuzed.
It appears the browser you use guesses unknown elements to be inline
elements, which cannot contain the block level p element.
It seems to work, in part.
That's also known as "not working" :)
/L
--
Lasse Reichstein Nielsen - lrn@xxxxxxxxxx
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
.
- References:
- InnerHTML not grabbing entire HTML if <p> is present
- From: MaryA
- Re: InnerHTML not grabbing entire HTML if <p> is present
- From: Martin Honnen
- Re: InnerHTML not grabbing entire HTML if <p> is present
- From: MaryA
- InnerHTML not grabbing entire HTML if <p> is present
- Prev by Date: Re: InnerHTML not grabbing entire HTML if <p> is present
- Next by Date: Image map with links Javascript
- Previous by thread: Re: InnerHTML not grabbing entire HTML if <p> is present
- Next by thread: Re: InnerHTML not grabbing entire HTML if <p> is present
- Index(es):
Relevant Pages
|