The Table TD element does not respond to a background change request for onMouseOver events




Layout: Tables
15 years ago
12 years ago


(Reporter: Bruce Peterson, Unassigned)


({compat, testcase})

compat, testcase

Firefox Tracking Flags

(Not tracked)




(4 attachments)



15 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.3b) Gecko/20030210
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.3b) Gecko/20030210

 When attempting to use the TD background element with mouseover events, the
image does not update. Other browsers handle the background update request. 
This holds true even in quirks mode.

Code snippet:
<td onMouseOver="this.background='selected.gif'" >  

Reproducible: Always

Steps to Reproduce:
This TD tag will not work on Mozilla (or Netscape):

<td   background="inactive.gif"   
      onMouseOut="this.background='inactive.gif'" >

However, it's solid color analog will:

<td   bgcolor="blue" 
      onMouseOut="this.bgColor='blue'"  >
Actual Results:  
The background is not updated for images, only for solid colors.
Note: This is independant of .jpg/.gif

Expected Results:  
The TD element should have taken the .background <image> message and replace the
cell background with the appropriate image.

As other browsers handle the event properly I'm marking this as a "Major" bug,
you may drop the priority if that's an improper designation. I have alerted the
W3C organization of their omission of the background element from the <TD>
delcaration as this is a VERY common useage of the TD element and it's proper
useage should be defined.

Comment 1

15 years ago
Created attachment 115772 [details]
A minimal html page that shows the error.

Comment 2

15 years ago
Created attachment 115773 [details]
Supporting image to show error

Comment 3

15 years ago
Created attachment 115774 [details]
Second image to show the swap action
"background" has never been part of the HTML specification, and "bgcolor" has
been deprecated since 1998. Use CSS to give backgrounds to your table
cells...this is probably INVALID.
Keywords: compat, testcase

Comment 5

15 years ago
Created attachment 115839 [details]
standard compliant testcase

The testcase shows that the images swap as desired when one uses standard
compliant dom manipulations. Even more it works cross browser. IE and opera
work also fine with that code. RTFM :-) aka or

Comment 6

15 years ago
well.. i think this is probably out there but I couldn't find a dupe...

Also, regardless of the spec (which I think comment 4 is right about) since td
backgound="..." has been out there since NN4 & IE4 and indeed Mozilla supports
it too this bug should be either fixed (and I'd argue low priority) or marked

(btw... confirming behavior on OS-X... but gonna take one last stab at finding a
dupe before marking as such)

OS: Windows 2000 → All
Hardware: PC → All
Whiteboard: DUPEME
*** Bug 197593 has been marked as a duplicate of this bug. ***

Comment 8

15 years ago
  The TD object has both a style object and a background property.  The style
object has a background-image 

   Based upon an object oriented paradigm, the is a valid
reference.  Furthermore, the  STYLE IS OPTIONAL (RTM).

  In light of the HTML specification at, td.background is
just as valid as, regardless of the depreciated status
of the background property, or the presence of a style element that does the
same function.

Comment 9

15 years ago

  The web site references, not td.background.   But following 
the paradigm on the web site a td element defined with <td background=xx> 
should be accessable with td.background    Sorry for any confusion with the 
last statement.

Comment 10

15 years ago
the testcase attachment 115839 [details] WFM ... on winXP and linux 
The image within a table cell is geting replaced by the other image on
mouseover/mouseout event calls.

Bruce, do u still see the bug  in the latest build ?


Comment 11

15 years ago
  As per your request I have downloaded the latest Mozilla and verified that the
background object for the TD element still doesn't respond to onMouseOver events.

From the version page:
Mozilla 1.4b
Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4b) Gecko/20030507

OS:  Windows2000
>  The TD object has both a style object and a background property.

Not quite.  It has a style object property and a background _attribute_. 
Attributes are not the same as properties, though there is some overlap in some
cases.  Attributes are present in the HTML; properties are pesent in the DOM. 
Some DOM properties will set appropriate attributes when they are set.

This is not quite what IE does, and this leads to some bugs in IE's DOM
implementation (for example IE completely mishandles the setting of the "value"
property on input elements, from the DOM's point of view).

> Based upon an object oriented paradigm, the is a valid
> reference.

Sure.  But the HTMLTableCellElement object does not have a "background"
property.  see for
the definition of this object.

> a td element defined with <td background=xx> should be accessable with
> td.background 

Unfortunately, no.  It should not be.

Using td.setAttribute("background") will set the background attribute, giving
the desired effect.  But setting the "background" property is not the same as
setting the attribute, so it doesn't do anything.
Last Resolved: 14 years ago
Resolution: --- → INVALID
Whiteboard: DUPEME
*** Bug 306204 has been marked as a duplicate of this bug. ***

Comment 14

13 years ago
Additional info from MSDN2003

HTML <ELEMENT BACKGROUND = sURL... >  <- handled valid 
Scripting object.background [ = sURL ]  <- handled invalid

Standards Information

This property is a Microsoft extension to HTML  and is defined in World Wide Web
Consortium (W3C) Document Object Model (DOM) Level 1 . 

BTW I think this still a major bug that still in 1.0.6 unresolved.
There is workaround by style.backgroundImage but i use JSCRIPT to load image in
background and i fear use style will cause on some browthers to reload image again. 
The MSDN page you're quoting is for the <html> element, not the <td> element. 
And this is not a bug.

Comment 16

12 years ago
*** Bug 340806 has been marked as a duplicate of this bug. ***
You need to log in before you can comment on or make changes to this bug.