Bug Tracker

Opened 5 years ago

Closed 5 years ago

Last modified 4 years ago

#9237 closed bug (fixed)

.css() doesn't work with relative values on hyphenated properties

Reported by: avaly2 Owned by:
Priority: blocker Milestone: 1.6.2
Component: css Version: 1.6
Keywords: Cc:
Blocked by: Blocking:

Description

The .css() in 1.6 accepts relative values, but they only work on certain properties (width, height, probably any property without hyphen), and fails to work on hyphenated properties written in any of the 2 ways: padding-left, paddingLeft, padding-top, paddingTop, etc.

See test case: http://jsfiddle.net/7cB8j/2/

Change History (6)

comment:1 Changed 5 years ago by avaly2

I went ahead and looked into this bug. It seems it was applying the new value without any unit, which works fine for width/height, but not for paddingLeft, paddingTop, etc.

Pull request including updated unit tests: https://github.com/jquery/jquery/pull/375

comment:2 Changed 5 years ago by timmywil

  • Component changed from unfiled to css
  • Milestone changed from 1.next to 1.6.2
  • Priority changed from undecided to blocker
  • Status changed from new to open

comment:3 Changed 5 years ago by nticompass@…

It seems that relative values don't work on the 'left' property either.

See this StackOverflow question: http://stackoverflow.com/q/5983034/206403

comment:4 Changed 5 years ago by avaly2

The left property works fine with the fix included in my pull request above.

comment:5 Changed 5 years ago by avaly

  • Resolution set to fixed
  • Status changed from open to closed

Landing pull request 375. Added test case to support #9237 Fixes #9237.

More Details:

comment:6 Changed 5 years ago by anonymous

$.animate() suffers from the same problems.

Note: See TracTickets for help on using tickets.