Re: html5 table border=1 warning

2014-03-13 1:56, Ken McInnes wrote:

> I have followed the recent previous discussions on this topic,

I suppose you mean

> but have started another thread.

I wonder why. It is generally useful to keep a discussion in one thread 
if it revolves around a specific topic. But maybe your point is that the 
previous discussion was about border=1 being reported as an error, which 
has been fixed (restored) to issuing just a warning, and you raise the 
question about the formulation of the warning.

> I am happy that we now have a validation warning for border=1 / border=0
> rather than an error.

Even a warning might be questionable. Note that this case is not 
mentioned in 11.1.1 Warnings for obsolete but conforming features. It 
might be argued that the list there is not exhaustive and validators may 
give warnings about anything they like. But I would prefer a more 
disciplined approach: issue an error when a conformance requirement is 
violated; issue a warning when the spec tells that a warning shall be 
issued; and do something else (say, issue a note) if there is something 
else you wish to say.

> The html5 spec has:
> The border attribute may be specified on a table element to explicitly
> indicate that the table element is not being used for layout purposes.
> If specified, the attribute's value must either be the empty string or
> the value "1". The attribute is used by certain user agents as an
> indication that borders should be drawn around cells of the table.
> This is not very clear,

Looks pretty clear to me as far the syntax is considered. Otherwise, it 
really avoids hitting the nail.

>   most coders/writers are using:
>   border=1 to indicate 'true'
>    and user agent should display a default border
>   border=0 to indicate 'false'
>    and user agent should not display a default border.

Really? I have rarely seen border=0 in <table>, and if I saw one, I 
would expect it to be used "just for safety", like many people use 
border=0 for an image even when it is not a link. In any case, it has no 

> In other words, border=1 or border=0 is logical mark-up, not
> presentational mark-up.

It seems that HTML5 CR and the validator are using different verbalisms 
to avoid saying what border=1 is really about. Its actual impact is that 
it makes a table look like a table even when CSS does not take effect, 
for some reason.

It might be said that by HTML5 CR, border=1 is "logical markup", or 
perhaps better "structural markup". But when HTML5 CR describes this, it 
is really just retrofitting a good practical decision in language design 
to a model that everything approved needs to be "semantic".

By HTML5 CR, border=0 is simply nonconforming, invalid.
Tables have been used for layout from the early days, and their use for 
layout was long much more common than their use for tabular data. 
Probably this is why browser be default don't draw any borders around 
cells. So when you use a table for tabular data, border=1 does some 
basic formatting, and then you start wondering how to tune it with CSS.

The validator is now even inconsistent with itself in the wordings:

border=1 causes the warning
"The border attribute on the table element is presentational markup. 
Consider using CSS instead. For example: table, td, th { border: 1px 
solid gray }"

border=2 causes the error message
"The border attribute on the table element is obsolete. Use CSS instead."

(The border attribute has not been declared obsolete.)

By the way, by declaring values other than "1" and "" as nonconforming, 
HTML5 CR definitions mean that validators do not do, or at least are not 
required to do, any distinction between border="2" (which has a 
well-defined meaning in HTML 4.01 and is implemented that way in 
browsers) and border="@" (which is nonconforming by any HTML spec).

In fact, even HTML5 CR describes the meaning of border="..." for values 
greater than 1, though just in the Rendering section, in 10.3.9:
"The table element's border attribute maps to the pixel length 
properties 'border-top-width', 'border-right-width', 
'border-bottom-width', 'border-left-width' on the element. If the 
attribute is present but parsing the attribute's value using the rules 
for parsing non-negative integers generates an error, a default value of 
1px is expected to be used for that property instead."

> The spec also suggests that somehow 'border' could be used to interpret
> that the table does / does not contain tabular data. This is a bit of a
> stretch, given current coding practices, and given all the legacy
> mark-up that is around.

Agreed. There has been no law against using border=1 for a layout table 
and no requirement that data tables use the border attribute. No 
software should make a guess about layout vs. data table on such grounds.

> Suggested solution:
> - for the validator - keep the warning, if border=0 or border=1,
> otherwise an error. Warning message should suggest CSS be used for
> presentation.

The use of border=0 is defined to be an error.

If border=1 is regarded is being "logical" (or "structural" or 
"semantic"), as you seem to be saying (maybe I misunderstood) and as 
HTML5 CR seems to be saying, it would be all wrong to suggest using CSS 

What should be done, if we regard HTML5 CR as the specification against 
which documents are validated, is this:

border (without value): passes

border="": passes

border="0": an error message (which might be accompanied by a note that 
the attribute has no effect)

border="1": passes

border="n" (where n is a number > 1, possibly followed by other 
characters): an error message (which might be accompanied by a note that 
says that the effect of the attribute can be achieved with CSS)

border with any other value: an error message (which might be 
accompanied by a note that says that the attribute is treated as border="1")


Received on Saturday, 15 March 2014 08:45:11 UTC