Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fixes #2164. #2197

Merged
merged 1 commit into from

3 participants

@ibolmo
Owner

Changed value property setter was too strict with defaulting to an empty
string. Now Element.set('value') for falsey values depends on toString
of that object for setting the right value.

PASSED: IE6-9; FFx 3-5, 8; 10; Safari 5; Opera 11; Chrome latest

@ibolmo ibolmo Fixes #2164.
Changed value property setter was too strict with defaulting to an empty
string. Now Element.set('value') for falsey values depends on toString
of that object for setting the right value.

PASSED: IE6-9; FFx 3-5, 8; 10; Safari 5; Opera 11; Chrome latest
0b42256
@cpojer cpojer merged commit d05c9fb into mootools:master
@angelsk

This still happens in IE7 - you cannot set the dropdown to value 0 - this is using 1.4.5 (and the dropdown has a blank value as well - it's a time widget).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 9, 2012
  1. @ibolmo

    Fixes #2164.

    ibolmo authored
    Changed value property setter was too strict with defaulting to an empty
    string. Now Element.set('value') for falsey values depends on toString
    of that object for setting the right value.
    
    PASSED: IE6-9; FFx 3-5, 8; 10; Safari 5; Opera 11; Chrome latest
This page is out of date. Refresh to see the latest.
View
2  Source/Element/Element.js
@@ -568,7 +568,7 @@ Object.append(propertySetters, {
},
'value': function(node, value){
- node.value = value || '';
+ node.value = (value != null) ? value : '';
}
});
View
5 Specs/1.4client/Element/Element.js
@@ -37,6 +37,11 @@ describe('Element', function(){
expect(new Element('input', {value: value}).get('value')).toEqual('');
});
+ it('should set a falsey value and not an empty string', function(){
+ expect(new Element('input', {value: false}).get('value')).toEqual('false');
+ expect(new Element('input', {value: 0}).get('value')).toEqual('0');
+ });
+
});
describe('type', function(){
Something went wrong with that request. Please try again.