[whatwg] href on any element

Lachlan Hunt lachlan.hunt at lachy.id.au
Tue Aug 29 00:28:57 PDT 2006

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):

> 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.

>> 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

More information about the whatwg mailing list