Closed
Description
Hi,
Here is my program (jsfiddle):
var Input = React.createClass({
render: function() {
return (
<input
{...this.props}
/>
);
}
});
var TestUtils = React.addons.TestUtils;
var inputInstance =
TestUtils.renderIntoDocument(
<Input
value='abc'
/>
);
var inputDOMNode = React.findDOMNode(inputInstance);
inputDOMNode.focus();
// Place cursor at the end.
inputDOMNode.setSelectionRange(3, 3);
// Should log 3 twice.
console.log(inputDOMNode.selectionStart);
console.log(inputDOMNode.selectionEnd);
Problem: 0
is logged twice in Chrome and Firefox.
What I expected: 3
is logged twice. We see this in Safari.
The interesting part is if we use React.render(..., document.body)
instead of TestUtils.renderIntoDocument
the program works as expected.
I am using:
- Chrome 42.0.2311.135
- Firefox 37.0.2
- Safari 8.0.5 (10600.5.17)