Closed Bug 1295 Opened 26 years ago Closed 26 years ago

Changing styles on table cells via DOM seems to remove table borders

Categories

(Core :: Layout: Tables, defect, P2)

x86
Other
defect

Tracking

()

VERIFIED FIXED

People

(Reporter: angus, Assigned: karnaze)

References

Details

I think there's something funky going on with the CSS OM code and borders. Here's some sample code: <html> <head> <script> var selectedCell = null; function select(e) { if (selectedCell) { selectedCell.style.backgroundColor="white"; selectedCell.style.color="black"; } selectedCell = this; this.style.backgroundColor="blue"; this.style.color="white"; } function init() { var cells = document.getElementsByTagName("TD"); for (var i=0; i<cells.length; i++) { cells[i].onmousedown=select; } } </script> </head> <body onload="init()"> <table id="mytable" border=1 cellspacing=3 cellpadding=10> <tr> <td>Apples</td> <td>Oranges</td> <td>Peaches</td> </tr> <tr> <td>Guitar</td> <td>Violin</td> <td>Bass</td> </tr> <tr> <td>Basketball</td> <td>Baseball</td> <td>Football</td> </tr> </table> </body> As you click on each cell, it should look "selected." Unfortunately, when I do this, the borders for the individual cells disappear as well, as though I were making a style declaration like: this.style.border="none"; Which I am not. Weird, huh? Not sure if this is tables or DOM or what...
*** Bug 1296 has been marked as a duplicate of this bug. ***
Status: NEW → ASSIGNED
*** Bug 1890 has been marked as a duplicate of this bug. ***
Assignee: buster → peterl
Status: ASSIGNED → NEW
My guess is this: The table cell border comes indirectly from the table "border" HTML attribute. Changing an attribute on the cell causes style to get re-resolved. The cell border is computed in DidSetStyleContext. DidSetStyleContext is only called if the re-resolved style context is different than the previous style context. This seems to be the case in the "selectedCell" case even though we're setting the selected cell's style.
Setting all current Open/Normal to M4.
per leger, assigning QA contacts to all open bugs without QA contacts according to list at http://bugzilla.mozilla.org/describecomponents.cgi?product=Browser
Status: NEW → ASSIGNED
Target Milestone: M4 → M6
Target Milestone: M6 → M7
Assignee: peterl → karnaze
Status: ASSIGNED → NEW
This requires the DidSetStyleContext logic for borders to be moved into the table MapAttributesInto code (stub in place).
Status: NEW → ASSIGNED
Target Milestone: M9 → M10
Status: ASSIGNED → RESOLVED
Closed: 26 years ago
Resolution: --- → FIXED
Fixed with latest checkin. You have to load the test page twice to get the javascript to work, but that's another bug that's probably been filed.
Status: RESOLVED → VERIFIED
Using 9/16 Apprunner, verified fixed. Clicking on each cell highlights the cell as selected
You need to log in before you can comment on or make changes to this bug.