Last Comment Bug 155507 - Borders collapse when rules="all" is declared
: Borders collapse when rules="all" is declared
Status: RESOLVED FIXED
[patch]
: testcase
Product: Core
Classification: Components
Component: CSS Parsing and Computation (show other bugs)
: Trunk
: All All
: P2 normal with 1 vote (vote)
: mozilla1.8beta2
Assigned To: Nobody; OK to take it and work on it
:
Mentors:
: 187258 188883 199573 (view as bug list)
Depends on: 43178 299723
Blocks: 56362 172213
  Show dependency treegraph
 
Reported: 2002-07-02 20:43 PDT by Gérard Talbot
Modified: 2010-01-10 07:53 PST (History)
10 users (show)
bernd_mozilla: in‑testsuite+
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
Table borders collapsing when rules="all" is declared (1.59 KB, text/html)
2002-07-02 20:46 PDT, Gérard Talbot
no flags Details
rules=cols demonstration for IE (2.05 KB, text/html)
2002-10-03 16:28 PDT, fantasai
no flags Details
Testcase (1.72 KB, text/html)
2002-10-05 15:44 PDT, Mats Palmgren (vacation)
no flags Details
IE6 rendering of "Testcase" (17.37 KB, image/png)
2002-10-05 15:47 PDT, Mats Palmgren (vacation)
no flags Details
patch (795 bytes, patch)
2004-01-20 15:32 PST, David Baron :dbaron: ⌚️UTC+8 (review requests must explain patch)
bernd_mozilla: review+
bzbarsky: superreview+
asa: approval1.8b2+
Details | Diff | Splinter Review

Description Gérard Talbot 2002-07-02 20:43:09 PDT
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.
Comment 1 Gérard Talbot 2002-07-02 20:46:13 PDT
Created attachment 90028 [details]
Table borders collapsing when rules="all" is declared
Comment 2 David Baron :dbaron: ⌚️UTC+8 (review requests must explain patch) 2002-07-02 20:48:23 PDT
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.
Comment 3 Eli Friedman 2002-09-02 18:12:10 PDT
This is being caused by the rule:
table[rules] {
  border-collapse: collapse;
}
in html.css
Comment 4 fantasai 2002-10-02 22:50:22 PDT
> This is being caused by the rule... in html.css.

So then, this could be fixed by adding
table[rules="all"] {
  border-collapse: separate;
}
Comment 5 David Baron :dbaron: ⌚️UTC+8 (review requests must explain patch) 2002-10-02 22:51:58 PDT
Or changing the selector to

table[rules]:not([rules="all"])
Comment 6 David Baron :dbaron: ⌚️UTC+8 (review requests must explain patch) 2002-10-02 22:56:01 PDT
FWIW, bug 21076 was reopened for what I think was essentially this issue.
Comment 7 Gérard Talbot 2002-10-03 00:56:55 PDT
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 fantasai 2002-10-03 16:28:14 PDT
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.
Comment 9 Gérard Talbot 2002-10-04 03:27:09 PDT
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;}

Comment 10 Hixie (not reading bugmail) 2002-10-04 08:56:22 PDT
   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.
Comment 11 Mats Palmgren (vacation) 2002-10-05 15:44:27 PDT
Created attachment 101842 [details]
Testcase
Comment 12 Mats Palmgren (vacation) 2002-10-05 15:47:04 PDT
Created attachment 101843 [details]
IE6 rendering of "Testcase"
Comment 13 Mats Palmgren (vacation) 2002-10-05 15:56:14 PDT
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.
Comment 14 Gérard Talbot 2002-10-22 05:40:54 PDT
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 Bernd 2002-12-31 08:24:20 PST
*** Bug 187258 has been marked as a duplicate of this bug. ***
Comment 16 Bernd 2003-01-13 05:26:11 PST
*** Bug 188883 has been marked as a duplicate of this bug. ***
Comment 17 Madhur Bhatia 2003-03-28 11:43:28 PST
*** Bug 199573 has been marked as a duplicate of this bug. ***
Comment 18 David Baron :dbaron: ⌚️UTC+8 (review requests must explain patch) 2004-01-20 15:32:19 PST
Created attachment 139525 [details] [diff] [review]
patch
Comment 19 Boris Zbarsky [:bz] 2004-01-20 15:52:25 PST
Comment on attachment 139525 [details] [diff] [review]
patch

sr=bzbarsky
Comment 20 Beat Zahnd 2004-01-21 02:18:38 PST
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 Bernd 2004-01-21 11:55:58 PST
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.
Comment 22 Anne (:annevk) 2005-02-13 09:18:13 PST
Why was this never checked in?
Comment 23 Samuel Sidler (old account; do not CC) 2005-04-27 17:10:55 PDT
This was assigned and a patch was made. Why wasn't it checked in?

Status update anyone? Ian, David?
Comment 24 Asa Dotzler [:asa] 2005-04-28 13:12:09 PDT
Comment on attachment 139525 [details] [diff] [review]
patch

a=asa
Comment 25 David Baron :dbaron: ⌚️UTC+8 (review requests must explain patch) 2005-04-28 13:56:13 PDT
Fix checked in to trunk, 2005-04-28 13:47 -0700.
Comment 26 Boris Zbarsky [:bz] 2005-09-27 06:31:22 PDT
The rules="all" part of this got backed out because it caused bug 310100.  It
looks like we need to get bug 43178 fixed...

Note You need to log in before you can comment on or make changes to this bug.