-
Notifications
You must be signed in to change notification settings - Fork 47.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove forced bubble code to prevent undo errors in IE9
Before this commit, IE9 would force a change event to fire when the onpropertychange callback fired. This threw an error when undoing text changes: React would try to update a text node that was detached from the DOM.
- Loading branch information
Showing
3 changed files
with
46 additions
and
43 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
fixtures/dom/src/components/fixtures/text-inputs/BubbledInputTestCase.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import Fixture from '../../Fixture'; | ||
const React = window.React; | ||
|
||
const noop = () => {}; | ||
|
||
class BubbledInputTestCase extends React.Component { | ||
state = { | ||
value: '', | ||
}; | ||
|
||
onChange = event => { | ||
this.setState({ | ||
value: (event.srcElement || event.target).value, | ||
}); | ||
}; | ||
|
||
render() { | ||
return ( | ||
<Fixture> | ||
<div className="control-box" onChange={this.onChange}> | ||
<fieldset> | ||
<legend>Controlled Text</legend> | ||
<input value={this.state.value} onChange={noop} /> | ||
<p className="hint">Value: {JSON.stringify(this.state.value)}</p> | ||
</fieldset> | ||
</div> | ||
</Fixture> | ||
); | ||
} | ||
} | ||
|
||
export default BubbledInputTestCase; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters