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

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Robert Hogan
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?


Reply | Threaded
Open this post in threaded view
|

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

Ms2ger
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.

HTH
Ms2ger