Andrew Fedoniouk wrote:
Lachlan Hunt wrote:
Andrew Fedoniouk wrote:
Ian Hickson wrote:
<a href="">
<h2>...</h2>
<p>...</p>
</a>
If we will change model of A from
<!ELEMENT A - - (%inline;)* -(A) -- anchor -->
to something else then it will create implications for parser.
What implications? Changing the formal content model of an element
doesn't change the way a parser needs to work. Ian's example above is
very similar to some real world examples I've seen and browser's
already handle it just fine.
These are non-conformant browsers :)
No, in this case, they're just handling the non-conformant content in
the most sane way, which I believe (in this case) is correct handling
according to traditional SGML rules.
See the Parse Tree produced by the validator for that construct
(ignore the 2 expected validation errors):
http://validator.w3.org/check?uri=data%3Atext%2Fhtml%3Bcharset%3Dutf-8%2C%253C%21DOCTYPE%2520a%2520PUBLIC%2520%2522-%252F%252FW3C%252F%252FDTD%2520HTML%25204.01%252F%252FEN%2522%253E%250D%250A%253Ca%2520href%253D%2522%2523%2522%253E%250D%250A%2520%2520%253Ch2%253E...%253C%252Fh2%253E%250D%250A%2520%2520%253Cp%253E...%253C%252Fp%253E%250D%250A%253C%252Fa%253E%2520&charset=%28detect+automatically%29&doctype=Inline&sp=1
A simply cannot have content other than inline constructions.
According to the formal content model, yes, but when a browser
encounters a real world document has that construct, what do you think
the browser should do with it?
What UA should do in this case is not specified. Using this
is as bad as violation of following:
See section 8 of the Web Apps 1.0 spec.
http://www.whatwg.org/specs/web-apps/current-work/#parsing
The DOM looks like this:
A
+-H2
+ P
And what is semantical meaning of that? Some hyperlinked section?
The A element is just defined as a hyperlink. Whether or not it's a
section is irrelevant.
If yes then let it be just :
<section href="...">
<h2>...
<p>...
</section>
But that isn't backwards compatible.
--
Lachlan Hunt
http://lachy.id.au/