Re: curly brackets within STYLE attribute

Yvonne Throgmorton wrote:
> 
> Mac IE and Win IE parse and render the following:
> 
>         <BODY STYLE="{color: red}">
> 
> While the specification doesn't say this is illegal, I never recall seeing
> an example of the STYLE attribute used this way in documentation or in test
> suites and was wondering what you think.

Eh eh, what a catch Yvonne ! It is not illegal, it is the only legal
way to specify a STYLE attribute !-(

Excerpt from HTML 4.0 spec, section 14.2.2 :

	The style attribute specifies style information for a single
	element. The style sheet language of inline style rules is
	given by the default style sheet language [p.173] . The syntax
	of style data [p.51] depends on the style sheet language.

The CSS2 spec contains in section 6.4.3 :

	In HTML, values of an element's "style" attribute are style sheet
	rules. These rules have no selectors ....

I can't find any other definition of the style data in STYLE attr.

So, according to the spec, the value of a STYLE attribute is a CSS rule
without selectors. A CSS rule is made of a selection part and a block
of declarations. Even if there is only one declaration attached to the
selectors, it is contained in a block materialized by curly braces.
So the value of a STYLE attribute *is* a list of declarations separated
by semi-colons, the whole set surronded by curly braces and the actual
common practice is not conformant to the spec.

Errata, IMHO.... The spec should mention that the value of the style
attribute is a list of declarations separated by semi-colons, not a
rule w/o selectors. Bert ?

</Daniel>

Received on Wednesday, 15 September 1999 08:51:08 UTC