#9826 closed bug (duplicate)
.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.
Change History (4)
comment:1 Changed 12 years ago by
Component: | unfiled → css |
---|---|
Priority: | undecided → low |
Resolution: | → duplicate |
Status: | new → closed |
comment:3 Changed 12 years ago by
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.
comment:4 Changed 12 years ago by
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()).
Note: See
TracTickets for help on using
tickets.
It is invalid to set any style to undefined.