dvtng / jss

JavaScript library for getting and setting CSS stylesheet rules
335 stars 55 forks source link

Added support for dashed css property format in get and set #5

Closed chrisburgess7 closed 12 years ago

chrisburgess7 commented 12 years ago

Added a method to convert a css property from dashed format (background-color) to camel case format (backgroundColor), so now it supports both. Makes things slightly more convenient to use, though perhaps at a slight performance cost, so there are pro's and con's with this.

macgyver commented 12 years ago

Based on my own experience (i.e. the bugs the QA team has reported to me) this is only necessary in Firefox. Chris is that consistent with your own info?

chrisburgess7 commented 12 years ago

I just re-tested this by replacing the propName = jss._toCamelCase(prop) with just propName = prop in the get method, so that it was using the unconverted property argument, and I passed in 'margin-left'. This caused jss to return undefined in FF8, IE9 and Opera 11.60, where before, using the _toCamelCase method, it was returning successfully. Safari 5.0.5 and Chrome 16 (webkit) still handles the dashed property correctly however.

macgyver commented 12 years ago

Wow that sounds like a big enough issue that it's worth pulling into the project, I'll definitely be using the chrisburgess version.