Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTML spec has CSS rule that is arbitrary and doesn't match reality: table, td, th { border-color: gray; } #4391

Closed
dholbert opened this issue Feb 25, 2019 · 8 comments
Labels
good first issue Ideal for someone new to a WHATWG standard or software project interop Implementations are not interoperable with each other topic: rendering

Comments

@dholbert
Copy link
Contributor

The HTML spec requires the following CSS rule for table rendering:

table, td, th { border-color: gray; }

https://html.spec.whatwg.org/multipage/rendering.html#tables-2

However, in practice, no browser actually implements that. Testcase:
https://bug1530048.bmoattachments.org/attachment.cgi?id=9046083

Observations from viewing that testcase in various engines:

  • Firefox, Edge, and IE don't have any version of that rule (in standards mode[1]) -- they leave border-color at its initial value (currentcolor, i.e. black) for table, td, and th.
  • Chrome and Safari seem to apply that HTML rule for table, but not for td or th, which makes for weird/inconsistent results if you make borders show up on all of these elements as shown in my testcase.

Perhaps we should just remove this rule from the spec, because nobody implements it as-written? I imagine it was for backwards-compatibility at some point, but clearly the web doesn't depend on it.

[1] Note: Firefox technically has a more-extreme version of the HTML spec's rule, but it only applies in quirks mode.

@dholbert dholbert changed the title HTML spec has border-color CSS rule that is arbitrary and doesn't match reality HTML spec has CSS rule fthat is arbitrary and doesn't match reality: table, td, th { border-color: gray; } Feb 25, 2019
@dholbert
Copy link
Contributor Author

dholbert commented Feb 25, 2019

Here's a slightly more comprehensive test:
https://bug1530048.bmoattachments.org/attachment.cgi?id=9046453

In this testcase:

  • I'm using a non-default color:teal declaration, to make it easier to see where we're using currentColor (which is the initial value for border-color).
  • I'm testing border-style:solid and also* border-style:inset and outset (the more traditional table border styles).
  • I'm testing a case with explicit border-color:pink to see if that's honored (it is, in all browsers I tested).

This testcase clearly demonstrates the following:

  • Firefox, Edge, and IE11 all have the default border-color: currentColor behavior for the table borders here -- no special UA-stylesheet rule, and no magic behavior.
  • Chrome and Safari, in contrast, do have a UA-stylesheet rule (but not the one from the HTML5 spec), and they do have some magic behavior:
    -- Their UA stylesheet rule is table { border-color: grey} (shown in Chrome's devtools).
    -- And the magic behavior has to do with how they resolve the initial border-color value on their td and th elements. If the td or th has border-style:solid or dashed or dotted (as shown in top part of the testcase), then they use the actual current CSS color value, as you would expect. But if the element has border-style:inset or outset, then they use a very light grayish color (not literally gray but the much-lighter rgb(238, 238, 238)) for no clear reason.

@dholbert
Copy link
Contributor Author

dholbert commented Feb 25, 2019

I filed https://bugs.chromium.org/p/chromium/issues/detail?id=935708 and https://bugs.webkit.org/show_bug.cgi?id=195015 on the Chrome/Safari (Blink/WebKit) magic behavior for td and th border coloring.

@dholbert dholbert changed the title HTML spec has CSS rule fthat is arbitrary and doesn't match reality: table, td, th { border-color: gray; } HTML spec has CSS rule that is arbitrary and doesn't match reality: table, td, th { border-color: gray; } Feb 25, 2019
@dholbert
Copy link
Contributor Author

...and I filed https://bugs.chromium.org/p/chromium/issues/detail?id=935729 and https://bugs.webkit.org/show_bug.cgi?id=195016 to remove the Chrome/Safari (Blink/Webkit) table { border-color: grey } UA stylesheet rule, assuming that this spec change is agreed upon.

And I'll plan on removing Firefox's quirks-mode-specific [all table parts] { border-color:gray } rule in https://bugzilla.mozilla.org/show_bug.cgi?id=1530048 .

@annevk
Copy link
Member

annevk commented Feb 26, 2019

So assuming the other implementers do not object, all that remains here is removing table, td, th { border-color: gray; }? Did you write web-platform-tests by any chance?

@annevk annevk added topic: rendering interop Implementations are not interoperable with each other labels Feb 26, 2019
@dholbert
Copy link
Contributor Author

So assuming the other implementers do not object, all that remains here is removing table, td, th { border-color: gray; }?

That's the only change I'm aware of needing here, yeah.

Did you write web-platform-tests by any chance?

Not yet, but I'm planning on including some in https://bugzilla.mozilla.org/show_bug.cgi?id=1530048

@dholbert
Copy link
Contributor Author

Here are my WPT testcases:
standards-mode testcase: https://dholbert.github.io/tests/tables/table-border-3s.html
quirks-mode testcase: https://dholbert.github.io/tests/tables/table-border-3q.html

reference case: https://dholbert.github.io/tests/tables/table-border-3-ref.html

(As far as I know, these standards/quirks-mode testcases only differ from each other in current Firefox (until I land bug 1530048). No other browser cares about quirks vs. standards mode here.)

@annevk annevk added the good first issue Ideal for someone new to a WHATWG standard or software project label Feb 27, 2019
@annevk
Copy link
Member

annevk commented Feb 27, 2019

Thanks for taking care of all the hard work @dholbert! If anyone wants to take on a PR against the HTML Standard source resource, it should be relatively straightforward to remove the line of CSS mentioned in #4391 (comment).

@dholbert
Copy link
Contributor Author

I posted a pull request to remove this rule -- it's #4398. Hopefully I did things right -- @annevk, let me know if there's anything else I should do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Ideal for someone new to a WHATWG standard or software project interop Implementations are not interoperable with each other topic: rendering
Development

No branches or pull requests

2 participants