Closed Bug 161042 Opened 23 years ago Closed 22 years ago

td.align is "left" even if in <tr align=center>

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
minor

Tracking

()

RESOLVED FIXED
mozilla1.2alpha

People

(Reporter: jruderman, Assigned: jst)

Details

(Whiteboard: [HAVE FIX])

Attachments

(2 files)

For the following code: <table> <tr align=center> <td>foo</td> </tr> </table> td.align is "left" even though the text in the td is centered. td.align should be "center" or the empty string. IE makes td.align be the empty string. Setting td.align to "left" makes the text in the cell become aligned left, which is even more strange. I ran into this bug while writing the "transpose tables" bookmarklet for http://www.squarefree.com/bookmarklets/pagedata.html. I want to copy the align attribute from trs to tds when the tds don't have the align attribute (like I do for bgColor), but because of this bug I can't tell whether a td has the align attribute.
Attached file testcase
Peterv, could you review?
Status: NEW → ASSIGNED
OS: Windows XP → All
Hardware: PC → All
Whiteboard: [HAVE FIX]
Target Milestone: --- → mozilla1.2alpha
Comment on attachment 94058 [details] [diff] [review] Proposed fix, ask cell's row for the align property if there's no align attribute on the cell. - /* ignore these attributes, stored simply as strings - ch - */ - /* attributes that resolve to integers with default=0*/ + /* ignore these attributes, stored simply as strings ch */ The "ch" should be separated from the rest of that.. I suggest a colon after "strings". sr=bzbarsky with that.
Attachment #94058 - Flags: superreview+
Comment on attachment 94058 [details] [diff] [review] Proposed fix, ask cell's row for the align property if there's no align attribute on the cell. r=peterv
Attachment #94058 - Flags: review+
Fixed.
Status: ASSIGNED → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
Hrm. Making it be the empty string seems much more reasonable, and would match IE, and also actually conformant to DOM HTML: http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-82915075 ...unless you actually want to make it implement the "inheritance of alignment specifications" stuff in bug 915, but in that case you'd want more than just rows.
Component: DOM: HTML → DOM: Core & HTML
QA Contact: stummala → general
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: