ISSUE-38: Syntax of the style attribute

style-attr-syntax

Syntax of the style attribute

State:
CLOSED
Product:
HTML 5 spec
Raised by:
James Graham
Opened on:
2008-03-31
Description:
On behalf of Daniel Glazman/the CSS WG:

The CSS WG has found today an incompatibility problem between the HTML4
and the HTML5 definitions of the style attribute.

Excerpt from HTML 4.01 spec [1]:

For example, for CSS2 inline style, use the declaration block
syntax described in section 4.1.8 (without curly brace delimiters).

Excerpt from HTML 5 spec [2]:

The style attribute, if specified, must contain only a list of zero
or more semicolon-separated (;) CSS declarations.

This change has an implication on the error handling supposed to occur
during the parsing of the contents of the attibute. An example is the
following one :

style="color:lime; (; color:red"

HTML 5 will make the element red, because HTML 5 explicitely splits
the contents of the attribute at semicolons.
The error handler looking for the matching closing parenthesis does not
find it at all, the () pair on the stack is closed finding the semicolon
ending the declaration.
In HTML 4, the style attribute holding the contents of a CSS block, the
error handler will look for the matching closing parenthesis as required
by CSS 2.1 until the end of the attribute's content. The element will
then be lime.

The CSS WG would like the definition of the style attribute in
HTML 5 to go back to the phrasing of HTML 4, entirely leaving the
definition of that attribute's value to the stylesheet's language
and error handling. We don't think HTML 5 should define the contents
of the style attribute in deeper details than what HTML 4 does,
and in particular should not specify how individual stylistic data
are separated inside the value of the style attribute.

Thanks.

[1] http://www.w3.org/TR/1999/REC-html401-19991224/present/styles.html#adef-style
[2] http://www.w3.org/html/wg/html5/#style0

</Daniel>, CSS WG co-chair

Related Actions Items:
Related emails:
  1. Issues closed (from mjs@apple.com on 2009-08-20)
  2. {agenda} HTML WG telcon 2009-08-20 (from rubys@intertwingly.net on 2009-08-19)
  3. Old issues - will be closed on 2009-08-20 if there are no objections (from mjs@apple.com on 2009-08-13)
  4. ISSUE-38 - style-attr-syntax - suggest closing on 2009-08-20 (from mjs@apple.com on 2009-08-13)
  5. Re: {agenda} HTML WG telcon 2009-08-13 (from cooper@w3.org on 2009-08-12)
  6. Re: {agenda} HTML WG telcon 2009-08-13 (from singer@apple.com on 2009-08-12)
  7. {agenda} HTML WG telcon 2009-08-13 (from rubys@intertwingly.net on 2009-08-12)
  8. More suggested issues to close (from mjs@apple.com on 2009-08-12)
  9. minutes HTML weekly 9 July for review (from connolly@w3.org on 2009-07-09)
  10. {minutes} HTML WG issue-tracking telcon 2008-06-05 (from mike@w3.org on 2008-06-06)
  11. minutes HTML WG weekly 17 Apr (from connolly@w3.org on 2008-04-17)
  12. {minutes} HTML WG issue-tracking telcon 2008-04-10/11 (from mike@w3.org on 2008-04-11)
  13. make that issue-38.. [was: Definition of the style attribute in HTML 5] (from mike@w3.org on 2008-04-04)
  14. ISSUE-38 (style-attr-syntax): Syntax of the style attribute (from sysbot+tracker@w3.org on 2008-03-31)

Related notes:

mail about this issue is also tracked at http://www.whatwg.org/issues/ in the "rendering-style-attribute" section

Michael[tm] Smith, 4 Apr 2008, 06:49:13

Changelog:

Created issue 'Syntax of the style attribute' nickname style-attr-syntax owned by James Graham on product , description 'On behalf of Daniel Glazman/the CSS WG:

The CSS WG has found today an incompatibility problem between the HTML4
and the HTML5 definitions of the style attribute.

Excerpt from HTML 4.01 spec [1]:

For example, for CSS2 inline style, use the declaration block
syntax described in section 4.1.8 (without curly brace delimiters).

Excerpt from HTML 5 spec [2]:

The style attribute, if specified, must contain only a list of zero
or more semicolon-separated (;) CSS declarations.

This change has an implication on the error handling supposed to occur
during the parsing of the contents of the attibute. An example is the
following one :

style="color:lime; (; color:red"

HTML 5 will make the element red, because HTML 5 explicitely splits
the contents of the attribute at semicolons.
The error handler looking for the matching closing parenthesis does not
find it at all, the () pair on the stack is closed finding the semicolon
ending the declaration.
In HTML 4, the style attribute holding the contents of a CSS block, the
error handler will look for the matching closing parenthesis as required
by CSS 2.1 until the end of the attribute's content. The element will
then be lime.

The CSS WG would like the definition of the style attribute in
HTML 5 to go back to the phrasing of HTML 4, entirely leaving the
definition of that attribute's value to the stylesheet's language
and error handling. We don't think HTML 5 should define the contents
of the style attribute in deeper details than what HTML 4 does,
and in particular should not specify how individual stylistic data
are separated inside the value of the style attribute.

Thanks.

[1] http://www.w3.org/TR/1999/REC-html401-19991224/present/styles.html#adef-style
[2] http://www.w3.org/html/wg/html5/#style0

</Daniel>, CSS WG co-chair

' non-public

James Graham, 31 Mar 2008, 17:41:29

Product changed to HTML 5 spec

31 Mar 2008, 17:54:56

Status changed to 'closed'

Maciej Stachowiak, 21 Aug 2009, 01:39:16


Paul Cotton <Paul.Cotton@microsoft.com>, Maciej Stachowiak <mjs@apple.com>, Sam Ruby <rubys@intertwingly.net>, Chairs, Michael[tm] Smith <mike@w3.org>, Staff Contact
Tracker: documentation, (configuration for this group), originally developed by Dean Jackson, is developed and maintained by the Systems Team <w3t-sys@w3.org>.
$Id: index.php,v 1.325 2014-09-10 21:42:02 ted Exp $