This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 9227 - Setting IDL attributes that map enumerated content attributes to invalid values should not throw
Summary: Setting IDL attributes that map enumerated content attributes to invalid valu...
Status: RESOLVED FIXED
Alias: None
Product: HTML WG
Classification: Unclassified
Component: pre-LC1 HTML5 spec (editor: Ian Hickson) (show other bugs)
Version: unspecified
Hardware: PC All
: P3 normal
Target Milestone: ---
Assignee: Ian 'Hixie' Hickson
QA Contact: HTML WG Bugzilla archive list
URL: http://dev.w3.org/html5/spec/infrastr...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-03-12 03:39 UTC by Boris Zbarsky
Modified: 2010-10-04 14:28 UTC (History)
7 users (show)

See Also:


Attachments

Description Boris Zbarsky 2010-03-12 03:39:42 UTC
The text at http://dev.w3.org/html5/spec/infrastructure.html#reflect says:

  "If a reflecting IDL attribute is a DOMString whose content attribute
   is an enumerated attribute ...
   ....
   on setting, if the new value is an ASCII case-insensitive match for
   one of the keywords given for that attribute, then the content
   attribute must be set to the conforming value associated with the
   state that the attribute would be in if set to the given new value,
   otherwise, if the new value is the empty string, then the content
   attribute must be removed, otherwise, the setter must raise a
   SYNTAX_ERR  exception."

I just tested, and IE seems to be the only browser I have that raises such a SYNTAX_ERR exception.  Gecko, Webkit (both Chrome and Safari incarnations) and Opera all allow the set to happen, though exact behavior after that is not interoperable: Webkit silently ignores the set, while Gecko and Opera update the content attribute to the given value.

I would obviously prefer the Gecko/Opera behavior here, since that's simplest in terms of implementation complexity for me.  But past that, I strongly object to moving from a situation where no exception is thrown to one where an exception is thrown.  That's likely to lead to web compatibility issues, in my experience, especially given the current tendency towards "IE" and "not IE" codepaths and the fact that none of the non-IE browsers throw an exception.
Comment 1 Anne 2010-03-12 07:03:45 UTC
It would be nice if we retain the feature that it only returns known values (and not simply the content attribute value) so you can keep doing some kind of feature testing. (It might be that everyone already does this, I have not checked.)
Comment 2 Boris Zbarsky 2010-03-12 14:50:13 UTC
Gecko does not do the "return known values" thing at the moment.  It will canonicalize the value if it's in the known set, but will return whatever the value is otherwise.

But that's a separate discussion, and we might be able to change that behavior.  Note that I carefully snipped out the getting part of the spec when quoting; this bug is very much about the setting part.
Comment 3 Ian 'Hixie' Hickson 2010-04-01 02:31:53 UTC
EDITOR'S RESPONSE: This is an Editor's Response to your comment. If you are satisfied with this response, please change the state of this bug to CLOSED. If you have additional information and would like the editor to reconsider, please reopen this bug. If you would like to escalate the issue to the full HTML Working Group, please add the TrackerRequest keyword to this bug, and suggest title and text for the tracker issue; or you may create a tracker issue yourself, if you are able to do so. For more details, see this document:
   http://dev.w3.org/html5/decision-policy/decision-policy.html

Status: Accepted
Change Description: see diff given below
Rationale: Concurred with reporter's comments.
Comment 4 contributor 2010-04-01 02:32:09 UTC
Checked in as WHATWG revision r4934.
Check-in comment: Make IDL setters of enumerated attributes not throw an exception but instead pass invalid values through unmodified.
http://html5.org/tools/web-apps-tracker?from=4933&to=4934