[whatwg] Attributes vs. Elements

Andrew Fedoniouk news at terrainformatica.com
Mon Mar 12 15:55:14 PDT 2007

----- Original Message ----- 
From: "Nicholas Shanks" <contact at nickshanks.com>
To: "Andrew Fedoniouk" <news at terrainformatica.com>
Cc: "WHATWG List" <whatwg at whatwg.org>
Sent: Monday, March 12, 2007 12:59 PM
Subject: Re: [whatwg] Attributes vs. Elements

| On 12 Mar 2007, at 20:19, Andrew Fedoniouk wrote:
| > Case:
| > <td ><a href="1.htm">xyz</a></td>
| > <td ><a href="2.htm">xyz-xyz-xyz</a></td>
| > is perfectly valid from some abstract semantic machine
| > point of view but for human these two cells are not
| > equal. At least hit area is different. And visual perception too.
| All you need to do is add this to your CSS:
| td > a:link { display: block; }

display: block does not work in this case.

It should be something close to this:
a:link { display: block; width: 100%; height:100%; }
but as you know width: 100%; height:100%;  will 
not work in presence of borders and absence of 
explicit definitions of heights and widths in parents.

In general declaration of { display: block; } for
naturally inline elements does not work well in modern CSS

Flex units I am using [1,2] may help in this case:
a:link { display: block; border: 1px; width: 100%%; height:100%%; }
but CSS is not there yet.

| and the whole cell content area will become clickable (i.e. the area  
| interior to the padding. don't use padding on the cell if you want to  
| run the clickable area up to the cell's border)

up to *but not including* the cell's border ?
and what about height? And what if vertical 
alignment is used? Too many unknowns.

| > I do not really understand this too:
| > "browser implementations have an implementation class per element"
| Most HTML implementations use a class hierarchy whereby each HTML  
| element is represented by a distinct subclass of some abstract base  
| element representation. To move href onto every element would require  
| moving the hyperlink functionality into that base class rather than  
| having it in the anchor subclass.

I think that this is a bit idealistic picture of what is going on in reality.

In my particular case DOM element is a single entitiy (class in C++).
But each DOM element may have mutiple behaviors attached.
That behaviors are handlers of events and are indeed various 
classes in C++ derived from common super class. 
So when you are asking DOM element to provide interface 
IHTMLAnchorElement for example it will try to find it 
in the chain of  all attached behaviors. And this chain is 
dynamic in principle. 
Again this is my particular architecture but I beleive other
HTML/CSS DOM implementations are close to that.

| For some browsers this could be quite easy, for others it would be  
| deceptively difficult.

Well, HTML/CSS is not so easy thing in implementation.
I mean this fact does not stop UA vendors from development.

Andrew Fedoniouk.

[1] Flex units in h-smile core http://terrainformatica.com/htmlayout/fspu.whtm
that is a generalization of "relative length units" used in HTML 4.01
[2] http://www.w3.org/TR/html401/types.html#type-length

More information about the whatwg mailing list