mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Removes value from rendered attributes of textarea
This commit is contained in:
@@ -88,8 +88,7 @@ var ReactDOMTextarea = ReactCompositeComponent.createClass({
|
||||
// `textContent` (unnecessary since we update value).
|
||||
// The initial value can be a boolean or object so that's why it's
|
||||
// forced to be a string.
|
||||
initialValue: '' + (value != null ? value : defaultValue),
|
||||
value: defaultValue
|
||||
initialValue: '' + (value != null ? value : defaultValue)
|
||||
};
|
||||
},
|
||||
|
||||
@@ -101,7 +100,6 @@ var ReactDOMTextarea = ReactCompositeComponent.createClass({
|
||||
render: function() {
|
||||
// Clone `this.props` so we don't mutate the input.
|
||||
var props = merge(this.props);
|
||||
var value = LinkedValueUtils.getValue(this);
|
||||
|
||||
invariant(
|
||||
props.dangerouslySetInnerHTML == null,
|
||||
@@ -109,7 +107,7 @@ var ReactDOMTextarea = ReactCompositeComponent.createClass({
|
||||
);
|
||||
|
||||
props.defaultValue = null;
|
||||
props.value = value != null ? value : this.state.value;
|
||||
props.value = null;
|
||||
props.onChange = this._handleChange;
|
||||
|
||||
// Always set children to the same thing. In IE9, the selection range will
|
||||
|
||||
@@ -85,6 +85,14 @@ describe('ReactDOMTextarea', function() {
|
||||
expect(node.value).toBe('foobar');
|
||||
});
|
||||
|
||||
it('should not render value as an attribute', function() {
|
||||
var stub = <textarea value="giraffe" />;
|
||||
stub = renderTextarea(stub);
|
||||
var node = stub.getDOMNode();
|
||||
|
||||
expect(node.getAttribute('value')).toBe(null);
|
||||
});
|
||||
|
||||
it('should display `value` of number 0', function() {
|
||||
var stub = <textarea value={0} />;
|
||||
stub = renderTextarea(stub);
|
||||
|
||||
Reference in New Issue
Block a user