W3C home > Mailing lists > Public > www-html@w3.org > January 2013

Re: setAttribute("border", null) on a table creates a border

From: Ms2ger <ms2ger@gmail.com>
Date: Wed, 16 Jan 2013 09:23:53 +0100
Message-ID: <50F66399.3010503@gmail.com>
To: Robert Hogan <robhogan@gmail.com>
CC: www-html@w3.org
Hi Robert,

On 01/15/2013 09:09 PM, Robert Hogan wrote:
> At the moment WebKit is the only rendering engine that regards
> setAttribute("border", null) as not setting a border on a table. All
> other set a border, even in strict mode.
> Although the odd one out, WebKit seems to be correct per the DOM4 and
> IDL specs. See https://bugs.webkit.org/show_bug.cgi?id=102112
> I'd like to make WebKit interoperable on this with other browsers, so
> can we get the current treatment of 'null' as setting a border added
> to the spec?

You are mistaken; setAttribute("border", null) should set the border 
attribute to the string "null" per DOM and WebIDL. HTML has the 
following statement:

> Rules marked "only if border is not equivalent to zero" in the CSS
> block above is expected to only be applied if the border attribute
> mentioned in the selectors for the rule is not only present but, when
> parsed using the rules for parsing non-negative integers, is also
> found to have a value other than zero or to generate an error.

In this case, the "rules for parsing non-negative integers" will return 
an error, so the selectors apply, in particular:

> table[border] { border-style: outset; } /* only if border is not equivalent to zero */
> table[border] > tr > td, table[border] > tr > th,
> table[border] > thead > tr > td, table[border] > thead > tr > th,
> table[border] > tbody > tr > td, table[border] > tbody > tr > th,
> table[border] > tfoot > tr > td, table[border] > tfoot > tr > th {
>   /* only if border is not equivalent to zero */
>   border-width: 1px;
>   border-style: inset;
> }

and a border will be rendered.

Received on Wednesday, 16 January 2013 08:24:24 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 16 January 2013 08:24:24 GMT