#6385 closed bug (wontfix)
getOrSet('value', undefined) should be interpreted as an attempt to set the value, rather than get it.
Reported by: | mattlunn | Owned by: | |
---|---|---|---|
Priority: | low | Milestone: | 1.4.3 |
Component: | core | Version: | 1.4.2 |
Keywords: | attributes value | Cc: | |
Blocked by: | Blocking: |
Description
For methods such as val, html and attr, if the value parameter is undefined
the call is interpreted as a get action rather than a set, and the jQuery chain is broken.
As a value for value was provided (shame it was undefined), I would expect jQuery to treat the action as a set.
See http://www.jsfiddle.net/3CAta/ as an example.
Regards, Matt
Change History (2)
comment:1 Changed 13 years ago by
Keywords: | attributes value added |
---|---|
Priority: | → low |
Resolution: | → wontfix |
Status: | new → closed |
comment:2 Changed 13 years ago by
This behavior has changed in 1.4.3 though, most setters no longer treat the setter .method(undefined)
the same as a getter .method()
although that obviously has its own tradeoffs since we have to decide what setting something to undefined does.
See #4388 and #4130; if we've missed some then open a specific ticket and reference those two.
I believe the reason for this fallback is that:
Closing as I believe the present behavior offers more advantages than disadvantages.