[ZPT] Why does this cause a page template to be invalid?(longish)
Geir Bækholt
Geir Bækholt
Mon, 18 Mar 2002 20:57:42 +0100
Hello seb,
Monday, March 18, 2002, 13:49:54, you wrote:
>> > Don't know what's going on there, but I reduced it to a simpler test
>> > case:
>> >
>> > <p>
>> > <div>
>> >
>> > </div>
>> > </p>
>> >
>> > If you replace the <div>s with inline elements like <span>s, it works;
>> > if you use block elements like <table>, it doesn't.
>> Strange thing is that in the 'buggy' state no browser I've tried it in so
>> far complains, only the PT parser ?!?
sb> Yes, I reckon it's a PT parser bug. Either way, no browsers are strict
sb> about XHTML whereas the PT parser could be. But anyway I don't know
sb> much about it so I'll shut up now.
The parser is behaving correct in this example (no bug), and the HTML
in the example is broken. This has nothing to do with it being strict or XHTML
at all. The above is illegal markup , at least for HTML4.0 and later
(my guess is that it is illegal in all versions of HTML)...
>From the HTML4.0 Specification:
http://www.w3.org/TR/1998/REC-html40-19980424/struct/global.html#h-7.5.3
Quote:
"""
Content model
Generally, block-level elements may contain inline elements and
other block-level elements. Generally, inline elements may
contain only data and other inline elements. Inherent in this
structural distinction is the idea that block elements create "larger"
structures than inline elements.
"""
IMHO the parser should not behave in erroneous ways , even though most
browsers do so, and is showing correct behavior. I am incredibly happy
that someone finally made a templating system that keeps your HTML
proper. The web really needs this (there is really a lot of crap
out there...)
:-)
- oh , and that spec mentioned above - really makes for good reading
;-)
--
Geir Bækholt web-developer
geirh@funcom.com funcom oslo | webdev-team