Closed Bug 1083457 Opened 10 years ago Closed 10 years ago

Cannot set style property of node using CSS property name

Categories

(Core :: DOM: CSS Object Model, defect)

33 Branch
x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 958887

People

(Reporter: aarontam, Unassigned)

Details

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.101 Safari/537.36

Steps to reproduce:

1. Load this fiddle: http://jsfiddle.net/aarontam/tzuur4mq/
2. Enter a numeric value in the input field beneath the red box.
3. Click on the "Set z-index!" button


Actual results:

The z-index of the red box does not change.


Expected results:

The z-index of the red box should change to the value entered into the input field.
Component: Untriaged → DOM: CSS Object Model
Product: Firefox → Core
I noticed that this issue no longer occurs on the Firefox nightlies (I checked in 36.0a1 (2014-10-15)), but does reproduce in both Firefox for Android, Firefox Beta for Android, and FirefoxOS. I couldn't find the bug and/or change that resolved this issue, and am wondering if there are plans on applying this fix to these other variants? Should I file separate bugs for these? Thanks!
Summary: Cannot set z-index of node using CSS property name → Cannot set style property of node using CSS property name
I just discovered that this isn't specific to z-index, but any CSS property name with a dash.
This is a nonstandard WebKit extension that we were recently forced to implement (and get added to the CSSOM spec) because too many sites were using it.  :(

The change will propagate to the release channel in the normal way, shipping in Firefox 35 on January 13.  In the meantime, it's on the nightly channel and the Aurora channel, and will make it to the beta channel on November 24.
Status: UNCONFIRMED → RESOLVED
Closed: 10 years ago
Resolution: --- → DUPLICATE
Thanks for the update and the link to the original bug! I didn't realize this had been added to the spec recently, just assumed Chrome was following standards. We had been originally using the CSS property names in our framework's style processing engine, which utilized cssText, but we made some perf optimizations to use the CSStyleDeclaration object and having developers change the property name was not practical. Until this change propagates to the release channel, we'll look into possibly converting to the JavaScript-equivalent name for these browsers.
Note that the relevant conversion algorithm is actually specified as well.  It's at http://dev.w3.org/csswg/cssom/#css-property-to-idl-attribute

Except for the cssFloat/float bit, of course....
You need to log in before you can comment on or make changes to this bug.