Skip to content
This repository
Browse code

Merge pull request #2197 from ibolmo/fix-2164-element-falsey-value

Fixes #2164.
  • Loading branch information...
commit d05c9fb9fdf7371ebb2429c1e2443085e653f1bd 2 parents bf35c9f + 0b42256
Christoph Pojer authored January 09, 2012
2  Source/Element/Element.js
@@ -568,7 +568,7 @@ Object.append(propertySetters, {
568 568
 	},
569 569
 
570 570
 	'value': function(node, value){
571  
-		node.value = value || '';
  571
+		node.value = (value != null) ? value : '';
572 572
 	}
573 573
 
574 574
 });
5  Specs/1.4client/Element/Element.js
@@ -37,6 +37,11 @@ describe('Element', function(){
37 37
 				expect(new Element('input', {value: value}).get('value')).toEqual('');
38 38
 			});
39 39
 
  40
+			it('should set a falsey value and not an empty string', function(){
  41
+				expect(new Element('input', {value: false}).get('value')).toEqual('false');
  42
+				expect(new Element('input', {value: 0}).get('value')).toEqual('0');
  43
+			});
  44
+
40 45
 		});
41 46
 
42 47
 		describe('type', function(){

0 notes on commit d05c9fb

Please sign in to comment.
Something went wrong with that request. Please try again.