Bug Tracker

Opened 12 years ago

Closed 12 years ago

#7274 closed bug (worksforme)

dashes don't work when used in css() objects

Reported by: [email protected] Owned by:
Priority: low Milestone: 1.5
Component: unfiled Version: 1.4.3
Keywords: dashes css Cc:
Blocked by: Blocking:


hi e1,

if you want to change css values using an object as parameter like:

$( "#sample" ).css( {'width': a + 'px'} );

it does not work anymore if you use css properties that start with a dash/hyphen (-), jq ignores the obj key, e.x. transformation

$( "#sample" ).css( {'-moz-transform': 'rotate(' + a + 'deg)'} );

it works if you do it the single-property way:

$( "#sample" ).css( '-moz-transform', 'rotate(' + a + 'deg)' );

tested on windows 7, latest FF, webkit everything was ok in 1.4.2

Change History (1)

comment:1 Changed 12 years ago by addyosmani

Keywords: dashes css added
Priority: undecidedlow
Resolution: worksforme
Status: newclosed

Testing with FireFox latest:

  1. Your first test working fine http://jsfiddle.net/W5GSY/
  2. Your second test working fine http://jsfiddle.net/W5GSY/1/
  3. Your third test working fine http://jsfiddle.net/W5GSY/2/

(also tested with Chrome, Safari using the -webkit version of those attribs)

These are all functioning equally as well.
Note that if you're testing - properties across browsers you will obviously have to switch -moz and -webkit, but otherwise these are working perfectly for me.

Last edited 12 years ago by addyosmani (previous) (diff)
Note: See TracTickets for help on using tickets.