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 15712 - CSSTransformValue should not use named constants
Summary: CSSTransformValue should not use named constants
Status: RESOLVED WONTFIX
Alias: None
Product: CSS
Classification: Unclassified
Component: Transforms (show other bugs)
Version: unspecified
Hardware: All All
: P2 normal
Target Milestone: ---
Assignee: Simon Fraser
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-25 18:34 UTC by Aryeh Gregor
Modified: 2012-01-31 21:00 UTC (History)
5 users (show)

See Also:


Attachments

Description Aryeh Gregor 2012-01-25 18:34:07 UTC
CSSTransformValue's operationType is defined as an unsigned short.  This is a bad pattern that the web platform is trying to move away from, because it requires authors to do things like

  if (list.operationType == CSSTransformValue.CSS_TRANSLATE3D)

Instead, it should be a string, so that you can instead do

  if (list.operationType == "translate3d")

This has the added benefit that alert(list.operationType) will output something sensible, like "rotateX" instead of "14".  Likewise, looking at the variable in a debugger will display something sensible.  Numbers are harder to use, and don't serve any good purpose.

I'm assuming that CSSTransformValue isn't yet implemented by multiple UAs, only WebKit, so it can still be changed.  Note that AFAICT, even WebKit only allows you to get one with the non-standard .getCSSPropertyValue() method.
Comment 1 Simon Fraser 2012-01-31 21:00:24 UTC
We modeled this after CSSRule, which uses enums <http://dev.w3.org/csswg/cssom/#the-cssrule-interface>