browser-compat-data icon indicating copy to clipboard operation
browser-compat-data copied to clipboard

html.elements.tbody - "char" and "charoff" attributes - were/are they really ever supported?

Open myfonj opened this issue 3 years ago • 5 comments

What information was incorrect, unhelpful, or incomplete?

Compat tables suggest that construct like <tbody align="char" char="." charoff="3"> (or same attributes on col, tfoot, thead, td, tr, td) makes text cells aligned at . (dot) character in IE and Edge since "v12". Thrilling!

What did you expect to see?

Sad boring column indicating it was never been supported in any major browser.

Did you test this? If so, how?

I remember XHTML wars and HTML4.1 and this attribute is my personal favourite of nice but unreachable things in specs; I think I would have noticed if it was rally supported in any major browser at some point in history. (Although, I don't have pre-chromium edge at hand ATM, so maybe I missed it in the end. I'm pretty sure IE up to 11 did not support it, though.)

MDN page report details
  • Query: html.elements.tbody
  • MDN URL: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/tbody
  • Report started: 2022-04-04T14:49:16.122Z

myfonj avatar Apr 04 '22 17:04 myfonj

The functionality of char was moved into the CSS text-align property and it is indeed listed there. There is no compat data currently on MDN however or whether a vendor prefix is required. caniuse does not list compat info either.

This feature is actually quite useful, as aligning table cell text (usually by a decimal point) is not always solvable by using something like text-align: right (or the direction where the least significant digit goes).

text-align: <string> and text-align: <string> [alignment] do not work in Chrome, here is a simple example that uses it and does not appear to work in latest Chrome (Windows): https://codepen.io/strarsis/pen/WNgROEm

Notes and deprecation of the original attributes on MDN:

Also found a page with workarounds here: https://krijnhoetmer.nl/stuff/javascript/table-align-char/

strarsis avatar Feb 28 '23 13:02 strarsis

NVM, it is in the draft for CSS Text Module Level 4

https://drafts.csswg.org/css-text-4/#text-align-property

(since at least 2015). I was just not paying adequate attention.


The functionality of char was moved into the CSS text-align property […]

This is another interesting topic. It is indeed mentioned at the MDN page (https://developer.mozilla.org/en-US/docs/Web/CSS/text-align#values) as

<string> Experimental When applied to a table cell, specifies the alignment character around which the cell's contents will align.

yet only valid values in the linked specification

https://w3c.github.io/csswg-drafts/css-text/#text-align-property https://www.w3.org/TR/css-text-3/#text-align-property

is a fixed set of keywords:

Name: text-align Value: start | end | left | right | center | justify | match-parent | justify-all

Frankly don't remember any historical CSS specification that included

td { text-align: '.'; }

as a valid option, but now I see it in "W3C Working Draft 13 November 2012"

https://www.w3.org/TR/2012/WD-css3-text-20121113/#text-align

[ [ start | end | left | right | center ] || ] | justify | match-parent | start end

with a caveat in the introduction ("Status"), that reads

The following features are at risk and may be cut from the spec during its CR period if there are no (correct) implementations: [...] the ‘start end’ and ‘<string>’ values of ‘text-align’ [...]

I guess the bad scenario happened and no (major) browser managed to implement it so it had been dropped, or it simply disappeared when WHATWG got involved. Peeked into mail archives and it does not seem to be discussed back then, nor was it discussed in csswg-drafts.

myfonj avatar Feb 28 '23 16:02 myfonj

Related: https://github.com/mdn/browser-compat-data/pull/21828

caugner avatar Jan 17 '25 09:01 caugner

Seriously, seeing such misleading (?) information from the BCD at https://developer.mozilla.org/en-US/docs/Web/HTML/Element/tbody (and all other table elements) is really unfortunate :(

Image

Or is that information really correct and all browsers except Firefox support that all the time? Really?

myfonj avatar Jan 17 '25 14:01 myfonj

We actually have char/charoff data in the BCD tables of several table-related elements:

  • https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/col#browser_compatibility
  • https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/colgroup#browser_compatibility
  • https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/tbody#browser_compatibility
  • https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/td#browser_compatibility
  • https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/tfoot#browser_compatibility
  • https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/th#browser_compatibility
  • https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/thead#browser_compatibility
  • https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/tr#browser_compatibility

And there's also data for the HTMLTableColElement.chOff property.

Overall, the data is inconsistent with regard to Firefox supporting charoff or not. Based on bug 2212, Firefox likely has no support at all, except for the property (which bug 70014 suggests has been supported forever).

As for the other browsers, I tested https://www.hixie.ch/tests/evil/mixed/tables.html in Chrome and Safari, and it appears that none of them support <col align="char" char=".">, but this needs further testing.

Given that these attributes are deprecated, it is low priority for us to investigate and fix this data.

If anyone (e.g. @myfonj?) can provide a single JSBin example that simultaneously yet separately tests char and charoff on all of the above mentioned elements (think: one table for char and charoff each x one table per element), then I could take a quick look in BrowserStack Live to see if these were supported in older versions.

caugner avatar Jun 04 '25 13:06 caugner

For now, we should probably mark all those implementations as ~partial, and point to this bug~ unsupported.

caugner avatar Sep 29 '25 13:09 caugner