Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: XHTML Orphaned text representation in a DOM

From: Pavel Lepin <p.lepin@-------.--->
To: NULL
Date: 8/1/2007 10:04:00 AM


Peter Flynn <peter.nosp@m...> wrote in
<5h9ii4F3j74kmU1@m...>:
> Pavel Lepin wrote:
>> Mike <raathm@g...> wrote in
>> <1185879569.684575.166940@1...>:
>>> <div>
>>>     Some text
>>>     <span>blah blah</span>
>>>     Some more text
>>> </div>
>>>
>>> How is this represented in a DOM? The <span> should be a
>>> child element - are the "Some text" and "Some more text"
>>> sibling elements,
>> 
>> Sibling nodes of 'span' element, not sibling elements.
>> And child nodes of 'div' element.
> 
> And in general, don't do this at the div level. It'll make
> your teeth fall out, give you white hair, and end in tears
> and recriminations. Where possible, use better markup:
> 
> <div>
>      <p>Some text
>      <span>blah blah</span>
>      Some more text</p>
> </div>
> 
> Dangling mixed content (what you described) needs to be
> avoided.

Pardon my bluntness, but to me that looks silly and
superfluous; and it doesn't get rid of "dangling" text
nodes even if getting rid of them in document markup was a
good idea. Stuffing a p into a div looks weird--why would
you need a div then? It's just a block element with no
additional semantics. If you want a paragraph, use a p.

The entire "one text node per element" idea just doesn't
make much sense (in context of document markup, as opposed
to data markup), unless for some inexplicable reason you
want to stuff everything with default semantics into a
span; and that doesn't even work, because of the way
whitespace is handled in XHTML, and because of Gecko's
peculiar idiosyncrasies where long text nodes in DOM are
concerned. 

-- 
...the pleasure of obedience is pretty thin compared with
the pleasure of hearing a rotten tomato hit someone in the
rear end. -- Garrison Keillor


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent