How do table cells affect event declarations in the col element?

When an event, such as onclick, is declared in the col element of the HTML table, does this event affect the cells referenced by the col element? Is the event ignored? Is something else going on?

+6
javascript html standards xhtml
source share
1 answer

Great question.

The specification says:

<!ATTLIST COL -- column groups and properties -- %attrs; -- %coreattrs, %i18n, %events --- 

where %events says :

 <!ENTITY % events "onclick %Script; #IMPLIED -- a pointer button was clicked -- ondblclick %Script; #IMPLIED -- a pointer button was double clicked-- onmousedown %Script; #IMPLIED -- a pointer button was pressed down -- onmouseup %Script; #IMPLIED -- a pointer button was released -- onmouseover %Script; #IMPLIED -- a pointer was moved onto -- onmousemove %Script; #IMPLIED -- a pointer was moved within -- onmouseout %Script; #IMPLIED -- a pointer was moved away -- onkeypress %Script; #IMPLIED -- a key was pressed and released -- onkeydown %Script; #IMPLIED -- a key was pressed down -- onkeyup %Script; #IMPLIED -- a key was released --" > 

So yes, it is assumed that events should be supported for td s.

However, "supposed" is far from "does." The only way to find out is to check in all browsers and hope that it will work in future browsers.

Secondly, just use event delegation and bind once to the parent table . It will work now and forever.

+3
source share

All Articles