Side navigation
#9910 closed enhancement (fixed)
Opened July 26, 2011 12:51PM UTC
Closed July 26, 2011 02:13PM UTC
Last modified July 26, 2011 03:09PM UTC
Generally document behavior of setters when passed function returns undefined
| Reported by: | tj@crowdersoftware.com | Owned by: | |
|---|---|---|---|
| Priority: | low | Milestone: | None |
| Component: | attributes | Version: | 1.6.2 |
| Keywords: | neededdocs | Cc: | |
| Blocked by: | Blocking: |
Description
In ticket #8770, the attr function's behavior was clarified for when it's passed a callback function to use to set the value and the function returns undefined.
This applies generally to setters, though, like css, prop, presumably others. Recommend documenting the behavior consistently and clearly (the current attr wording is technically accurate, but convoluted). Something along the lines of:
Note: If the setter callback doesn't return a value or returns undefined, the current value is not changed. This can be useful for selectively setting values only when certain criteria are met.Attachments (0)
Change History (4)
Changed July 26, 2011 02:13PM UTC by comment:1
| component: | unfiled → attributes |
|---|---|
| keywords: | → neededdocs |
| priority: | undecided → low |
| resolution: | → fixed |
| status: | new → closed |
Changed July 26, 2011 02:39PM UTC by comment:2
Replying to [comment:1 timmywil]:
Docs updated: http://api.jquery.com/attr
Wow, fast! But this was logged primarily to get css, prop, and others that behave the same way changed, not about attr's wording. (But it's great to see it updated.)
Changed July 26, 2011 03:04PM UTC by comment:3
I went ahead and updated http://api.jquery.com/css and http://api.jquery.com/prop
Changed July 26, 2011 03:09PM UTC by comment:4
Replying to [comment:3 timmywil]:
I went ahead and updated http://api.jquery.com/css and http://api.jquery.com/prop
That's great! Nice one (and ''fast'').
Docs updated: http://api.jquery.com/attr