Borders collapse when rules="all" is declared

RESOLVED FIXED in mozilla1.8beta2

Status

()

Core
CSS Parsing and Computation
P2
normal
RESOLVED FIXED
15 years ago
8 years ago

People

(Reporter: Gérard Talbot, Unassigned)

Tracking

(Blocks: 1 bug, {testcase})

Trunk
mozilla1.8beta2
testcase
Points:
---
Dependency tree / graph
Bug Flags:
in-testsuite +

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [patch])

Attachments

(5 attachments)

(Reporter)

Description

15 years ago
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.
(Reporter)

Comment 1

15 years ago
Created attachment 90028 [details]
Table borders collapsing when rules="all" is declared
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

Updated

15 years ago
Keywords: testcase

Comment 3

15 years ago
This is being caused by the rule:
table[rules] {
  border-collapse: collapse;
}
in html.css

Comment 4

15 years ago
> 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"])
Whiteboard: [patch]
FWIW, bug 21076 was reopened for what I think was essentially this issue.
(Reporter)

Comment 7

15 years ago
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.

Comment 8

15 years ago
Created attachment 101609 [details]
rules=cols demonstration for IE

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.
(Reporter)

Comment 9

15 years ago
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.
Created attachment 101842 [details]
Testcase
Created attachment 101843 [details]
IE6 rendering of "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.
(Reporter)

Comment 14

15 years ago
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 }
}

Comment 15

15 years ago
*** Bug 187258 has been marked as a duplicate of this bug. ***

Comment 16

15 years ago
*** Bug 188883 has been marked as a duplicate of this bug. ***
Blocks: 172213

Comment 17

14 years ago
*** Bug 199573 has been marked as a duplicate of this bug. ***
Created attachment 139525 [details] [diff] [review]
patch
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+

Comment 20

14 years ago
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 21

14 years ago
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+

Updated

13 years ago
Blocks: 56362

Comment 22

13 years ago
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?
Attachment #139525 - Flags: approval1.8b2?

Comment 24

12 years ago
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
Last Resolved: 12 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

Comment 27

8 years ago
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
Last Resolved: 12 years ago8 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.