Side navigation
#3229 closed enhancement (fixed)
Opened August 07, 2008 03:39PM UTC
Closed October 02, 2010 01:53PM UTC
val: setting should check to see if this.value is a function so plugins can use it
Reported by: | DylanGreene | Owned by: | |
---|---|---|---|
Priority: | trivial | Milestone: | 1.3 |
Component: | attributes | Version: | 1.2.6 |
Keywords: | val, value, setter, getter | Cc: | DylanGreene, flesler |
Blocked by: | Blocking: |
Description
Currently val uses this to set the value
this.value = value;
This means plugin authors can't easily use val because we can't run a function when the value is changed.
This change would make it so that if this has a setter function it will use it:
if ( jQuery.isFunction( this.value ) ) this.value( value ); else this.value == value;
The same change should happen for the getter.
Attachments (0)
Change History (3)
Changed August 07, 2008 06:52PM UTC by comment:1
cc: | → DylanGreene, flesler |
---|---|
need: | Review → Test Case |
Changed June 20, 2010 08:00PM UTC by comment:2
component: | core → attributes |
---|
Changed October 02, 2010 01:53PM UTC by comment:3
resolution: | → fixed |
---|---|
status: | new → closed |
Implemented in 1.4.
val does a lot of things, we'd need to add this check many times.
For this case (just setting the value) you can use .attr() which is actually a faster way.
attr() supports functions. I think this enhancement is not needed.
Can you provide a test case that shows a real need for this, and that attr() can't be used ?