[wp-hackers] XHTML Strict Mode

Jamie Talbot wphackers at jamietalbot.com
Fri Aug 6 04:10:18 UTC 2004


Hi,

Yeah, I'd thought of differentiating inline from block tags, should be easily
achieved with an array of one or the other, then a simple test.  This could
then solve a wide range of the problems listed.  The question, as you put it is
whether to bother! :D

Scott, yeah take your point on the demonstrations.  Lots of demos I'd run came
out well, but it needs more intelligence on how to cope with other scenarios. 
Just shows how complicated it can get, eh?!  Your balanceTags is doing a great
job, but I'm quite taken with the idea of a full XHTML corrector.  Looked
around on the web and couldn't find anything, so it's obviously a huge
challenge and possibly not worth the effort!

More than anything, this is just a programming exercise.  I'm on a year off at
the moment teaching, but I want to keep my programming up if I'm going to get a
job when I rejoin the real world!  If anyone has anything more pressing that
could be helped by the attention of another, I'm open to suggestions!  In the
meantime, suppose I'll start trawling mosquito again!

Jamie.

--
http://www.jamietalbot.com/


Quoting Michael Leuchtenburg <michael at slashhome.org>:

> I agree that your other examples are all obviously broken, but I contest
> the following:
>
> Scott Reilly wrote:
> > 3.) ------------------------------
> >
> > <b>aaaa<div>bbb</div><i>ccc<hr />
> >
> > yielded:
> >
> > <b>aaaa</b><div>bbb</div><i>ccc<hr />
> > </i>
> >
> > (I feel balancing should close tags as late as possible; so for this, since
> > there is nothing in this example to prevent the <b> from being closed at
> the
> > end:
> > <b>aaaa<div>bbb</div><i>ccc<hr /></i></b>
>
> There is, in fact. According to the XHTML 1.0 Strict DTD, the b element
> can only contain elements in the Inline class:
> <!ELEMENT b %Inline;>
>
> div is a block element, and so can't be contained in b.
>
> Of course, if you just want to do pure balancing, then I agree with your
> proposed correct results. If you want to try to correct other broken
> XHTML, then more work is needed. I don't think it would be too much
> difficulty to differentiate between inline and block level elements, at
> least: doing things like avoiding an anchor tag inside another and other
> illegal results may be more work than is worthwhile. Assuming the user
> isn't a complete HTML ass seems reasonable, especially since the worst
> result is that the output is not XHTML compliant.
>
> -- michael
>
> _______________________________________________
> hackers mailing list
> hackers at wordpress.org
> http://wordpress.org/mailman/listinfo/hackers_wordpress.org
>




More information about the hackers mailing list