aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorjeresig <jeresig@gmail.com>2010-09-24 18:02:39 -0400
committerjeresig <jeresig@gmail.com>2010-09-24 18:02:39 -0400
commit83b261c9767e75b006b849481e6b0736956801e3 (patch)
tree42d8bc291f7b07ce5d094d3e9255546f04bd9828 /src
parentadff8e45e255409e8f78a3347dea01bdbee0a53d (diff)
parent0636dffc2481c14368464a22ffa1bd8017da2a26 (diff)
downloadjquery-83b261c9767e75b006b849481e6b0736956801e3.tar.gz
jquery-83b261c9767e75b006b849481e6b0736956801e3.zip
Merge branch 'master' of github.com:jquery/jquery
Diffstat (limited to 'src')
-rw-r--r--src/attributes.js9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/attributes.js b/src/attributes.js
index a76695b66..fd3e38ace 100644
--- a/src/attributes.js
+++ b/src/attributes.js
@@ -136,7 +136,7 @@ jQuery.fn.extend({
},
val: function( value ) {
- if ( value === undefined ) {
+ if ( !arguments.length ) {
var elem = this[0];
if ( elem ) {
@@ -209,9 +209,10 @@ jQuery.fn.extend({
val = value.call(this, i, self.val());
}
- // Typecast each time if the value is a Function and the appended
- // value is therefore different each time.
- if ( typeof val === "number" ) {
+ // Treat null/undefined as ""; convert numbers to string
+ if ( val == null ) {
+ val = "";
+ } else if ( typeof val === "number" ) {
val += "";
}