Closed Bug 155507 Opened 22 years ago Closed 14 years ago

Borders collapse when rules="all" is declared

Categories

(Core :: CSS Parsing and Computation, defect, P2)

defect

Tracking

()

RESOLVED FIXED
mozilla1.8beta2

People

(Reporter: bugzilla, Unassigned)

References

Details

(Keywords: testcase, Whiteboard: [patch])

Attachments

(5 files)

The default value for border-collapse is separate. If you add the attribute
rules="all", then the value of border-collapse becomes collapse; a given value
to cellspacing is ignored.
Opera 6 (O6 does not support the rules attribute anyway) and MSIE 6 do not react
this way.
Agreed, that seems bad for rules="all" mapping.  I'll try to remember to get to
this when I work on the other bug I own about cleaning up the code so it doesn't
use PostResolveCallbacks.
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Priority: -- → P2
Target Milestone: --- → Future
Keywords: testcase
This is being caused by the rule:
table[rules] {
  border-collapse: collapse;
}
in html.css
> This is being caused by the rule... in html.css.

So then, this could be fixed by adding
table[rules="all"] {
  border-collapse: separate;
}
OS: Windows XP → All
Hardware: PC → All
Or changing the selector to

table[rules]:not([rules="all"])
FWIW, bug 21076 was reopened for what I think was essentially this issue.
I don't even understand why one would want to declare a css rule where the
[rules] selector determines somehow the border-collapse property value of a
table. That, I don't understand.
MSIE 6 does not work like that.
Borders on rows and columns have no effect in the separated borders model.
That's why we need to use the collapsed borders model for tables with 'rules'.

http://www.w3.org/TR/REC-CSS2/tables.html#separated-borders

What MSIE is doing here is, I think, not actually possible in CSS. (And you
can't do it with CSS in MSIE, either.) In a table with rules=cols, the vertical
borders are painted *into* the cellspacing to connect them from cell to cell.
Re comment #8
So, this quote [ from http://www.w3.org/TR/REC-CSS2/tables.html#separated-borders ]
should be decisive:
"In this (separated border) model, each cell has an individual border. (...)
Rows, columns, row groups, and column groups cannot have borders (i.e., user
agents must ignore the border properties for those elements)."

So in other words:
1) table[rules="all"] implies border-collapse:separate
2) table[rules="cols"] implies border-collapse:collapse
3) table[rules="rows"] implies border-collapse:collapse
4) table[rules="groups"] implies border-collapse:collapse
5) table[rules="none"] implies border-collapse:collapse (?!?)

Did I get this right?

So, this bug could be solved by modifying html.css with these css3 attribute
selectors:
table[rules*="o"] {border-collapse:collapse;} 
/* every rules that has a value with the substring "o" at least once */
or
table[rules]:not([rules="all"]) {border-collapse:collapse;}
/* all of the rules values except when rules="all" */
and
table[rules="all"] {border-collapse:separate;}

   table[rules]:not([rules="all"]) {border-collapse:collapse;}

...would also match table with no rules attribute. Better would be to list the
values intended to affect border-collapse.

Anyway, this can't be done in html.css since it needs to be considered as author
level style (it's a presentational attribute) so it must be done at the
attribute mapping level.
Attached file Testcase
I'm against the idea that any of the values for the HTML attribute 'rules'
should imply 'border-collapse:collapse'. If the author hasn't explicitly
specified 'collapse' it should be 'separate', after all what would you do when
the author explicitly have style="border-collapse:separate" and rules="all" ?

I think the IE6 implementation of "separate rules" is excellent and in spirit
with the HTML spec regarding 'rules' (see attachment 101843 [details].)
IMHO, that is the rendering we should implement too.
Mats, what do you make of this which can be read at section 17.6.1 of CSS2 and
CSS2.1: 

"In this (separated border) model, each cell has an individual border. (...)
Rows, columns, row groups, and column groups cannot have borders (i.e., user
agents must ignore the border properties for those elements)."

Toward the end of section 17.6.2 of CSS2 and CSS2.1, the W3C give an example of
a table with rules="rows"; the border-collapse:collapse declaration is
explicitly stated to achieve that.

{The top border of the table is set to 'hidden' to suppress the top border of
the first row. This implements the "rules" attribute of HTML 4.0 (rules="rows").

TABLE[rules=rows] TR { border-top: solid }
TABLE[rules=rows]    { border-collapse: collapse; 
                       border-top: hidden }
}

*** Bug 187258 has been marked as a duplicate of this bug. ***
*** Bug 188883 has been marked as a duplicate of this bug. ***
Blocks: 172213
*** Bug 199573 has been marked as a duplicate of this bug. ***
Attachment #139525 - Flags: superreview?(bz-vacation)
Attachment #139525 - Flags: review?(bernd.mielke)
Comment on attachment 139525 [details] [diff] [review]
patch

sr=bzbarsky
Attachment #139525 - Flags: superreview?(bz-vacation) → superreview+
Borders still have broken styles for cols, rows and groups. Why?

I have a table with <colgroup span=2>, <td colspan=2> and <td rowspan=2>  and
simply want to have it looking the same way as simple tables. Without any CSS
hacks if possible.

On IE it works as expected
(http://bugzilla.mozilla.org/attachment.cgi?id=101843&action=view)
Comment on attachment 139525 [details] [diff] [review]
patch

this will probably still match rules="", but it fixes this bug, which is for me
more a reaction to public pressure than content driven.
Attachment #139525 - Flags: review?(bernd.mielke) → review+
Blocks: 56362
Why was this never checked in?
This was assigned and a patch was made. Why wasn't it checked in?

Status update anyone? Ian, David?
Comment on attachment 139525 [details] [diff] [review]
patch

a=asa
Attachment #139525 - Flags: approval1.8b2? → approval1.8b2+
Fix checked in to trunk, 2005-04-28 13:47 -0700.
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Target Milestone: Future → mozilla1.8beta2
Depends on: 299723
The rules="all" part of this got backed out because it caused bug 310100.  It
looks like we need to get bug 43178 fixed...
Status: RESOLVED → REOPENED
Depends on: 43178
Resolution: FIXED → ---
Assignee: dbaron → nobody
Status: REOPENED → NEW
QA Contact: ian → style-system
bug 43178 got fixed the test case is http://mxr.mozilla.org/mozilla-central/source/layout/reftests/table-bordercollapse/borderhandling-rules-border.html
Status: NEW → RESOLVED
Closed: 19 years ago14 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: