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 comment:1
component: | unfiled → css |
---|---|
priority: | undecided → low |
resolution: | → duplicate |
status: | new → closed |
Changed July 14, 2011 10:18PM UTC by 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 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()).
It is invalid to set any style to undefined.