[whatwg] Attributes vs. Elements

Nicholas Shanks contact at nickshanks.com
Mon Mar 12 13:59:55 PDT 2007


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

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)

> Even now you can use get/setAttribute methods to get/set 'href'
> attribute to any element.  So where do you see the problem?

But that doesn't make any of them clickable, because they are not  
anchor heads.

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

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

- Nicholas.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2157 bytes
Desc: not available
URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20070312/a4a7530b/attachment-0001.bin>


More information about the whatwg mailing list