On 27/01/2011 5:36 PM, Per Jessen wrote:
Lawrence @ Rogers wrote:
<div/> and<p/> may pass the validator, but that is most certainly a
bug. A quick look through the XHTML 1.0 DTD's reveals only ten tags
that may be closed using the short form, and I am unable to find any
documentation on the W3C web site to support anything otherwise.
<area />
<base />
<br />
<col />
<hr />
<img />
<input />
<link />
<meta />
<param />
Using any other shorthandled elements would result in HTML rendering
engines choking and giving unpredictable results.
I'm not so sure - I think relatively modern renderers are quite capable
of dealing with both<div/> and<p/> without causing any problems.
<p/> instead of<p></p> is not unusual.
What I was suggesting is that your belief is flawed because your test
was flawed itself. No e-mail will ever be just<head></head>. Ignoring
the fact that a<title> tag is required as a minimum (although many
e-mails probably omit it), the<head/> form is invalid as well.
Accepted, but it doesn't change the problem in html_eval_tag() - the
code doesn't attempt to validate html, it just does a simple regex
check for a balanced tag, but doesn't accept or ignore the short tag
version with no content.
I believe that the behavior of HTML_TAG_BALANCE_HEAD is valid in this
case, as<head/> is invalid HTML (despite what the validator says) and
should not be used by anyone.
True, but html_eval_tag() will fire on _any_ short tag.
/Per Jessen, Zürich
The problem is that, the majority of HTML e-mails out there are being
handled by older HTML engines (like IE7 or worse)
If it's firing on <head/> with no content, that's completely valid don't
you think? It's invalid HTML and contains no content. That throws the
balance off.
Any HTML coder will never assume that people are using programs with
modern HTML capabilities. Most of the world is only now finally letting
IE6 die.
Could you provide an example of a site using <div/> or <p/> shorthand
tags? I've never seen them before anywhere.
Previously, my understanding has always been that shorthanded closing
was only allowed for tags that didn't have a closing tag before (such as
<meta>). The HTML recommendations support this.
Perhaps there is further work to be done in SA regarding handling HTML
balancing, but <head/> is pointless to test for as it has no reason or
possible use in the real world.
If html_eval_tag() is firing on any short tag, and not just the invalid
example code, that would signal a possible bug and investigation.
Cheers,
Lawrence