Permalink
Browse files

avoid another use of `undefined`

  • Loading branch information...
1 parent d4763c2 commit e2fcccbfe1c4f68a54e8a29ad442d7d502b93034 @mislav mislav committed Nov 25, 2012
Showing with 4 additions and 3 deletions.
  1. +4 −3 src/zepto.js
View
7 src/zepto.js
@@ -545,9 +545,10 @@ var Zepto = (function() {
},
val: function(value){
return (value === undefined) ?
- (this.length > 0 ?
- (this[0].multiple ? $(this[0]).find('option').filter(function(o){ return this.selected }).pluck('value') : this[0].value) :
- undefined) :
+ (this[0] && (this[0].multiple ?
+ $(this[0]).find('option').filter(function(o){ return this.selected }).pluck('value') :
+ this[0].value)
+ ) :
this.each(function(idx){
this.value = funcArg(this, value, idx, this.value)
})

0 comments on commit e2fcccb

Please sign in to comment.