Skip to main content

Bug Tracker

Side navigation

#9826 closed bug (duplicate)

Opened July 14, 2011 07:15PM UTC

Closed July 14, 2011 07:45PM UTC

Last modified July 14, 2011 10:31PM UTC

.css(prop, undefined) should return self for chaining

Reported by: TJ Holowaychuk Owned by:
Priority: low Milestone: None
Component: css Version: 1.6.2
Keywords: Cc:
Blocked by: Blocking:
Description

the user's intention is clearly to change the value, so returning as if it were a getter is a bug.

Attachments (0)
Change History (4)

Changed July 14, 2011 07:45PM UTC by timmywil comment:1

component: unfiledcss
priority: undecidedlow
resolution: → duplicate
status: newclosed

It is invalid to set any style to undefined.

Changed July 14, 2011 07:45PM UTC by timmywil comment:2

Duplicate of #9427.

Changed July 14, 2011 10:18PM UTC by dmethvin comment:3

So if we returned the current jQuery object, what value should we set for the CSS property? Doing nothing would be a bad idea since the user's intention was clearly to change the value, so returning without setting a value would be a bug.

Changed July 14, 2011 10:31PM UTC by ajpiano comment:4

Also, this doesn't only affect .css()... It affects any method that's a getter and a setter, which behaves like a getter if it is passed two arguments and the second is undefined (a.k.a. .attr()).