Commit 0af300fe authored by Pascal Hartig's avatar Pascal Hartig

React: Upgrade app to 0.12

- Remove obsolete @jsx annotations
- Rename renderComponent -> render
- Use event.preventDefault instead of returning false
parent 29a6fae9
/**
* @jsx React.DOM
*/
/*jshint quotmark:false */
/*jshint white:false */
/*jshint trailing:false */
......@@ -42,14 +39,14 @@ var app = app || {};
return;
}
event.preventDefault();
var val = this.refs.newField.getDOMNode().value.trim();
if (val) {
this.props.model.addTodo(val);
this.refs.newField.getDOMNode().value = '';
}
return false;
},
toggleAll: function (event) {
......@@ -171,7 +168,7 @@ var app = app || {};
var model = new app.TodoModel('react-todos');
function render() {
React.renderComponent(
React.render(
<TodoApp model={model}/>,
document.getElementById('todoapp')
);
......
/**
* @jsx React.DOM
*/
/*jshint quotmark:false */
/*jshint white:false */
/*jshint trailing:false */
......
/**
* @jsx React.DOM
*/
/*jshint quotmark: false */
/*jshint white: false */
/*jshint trailing: false */
......@@ -15,7 +12,7 @@ var app = app || {};
var ENTER_KEY = 13;
app.TodoItem = React.createClass({
handleSubmit: function () {
handleSubmit: function (event) {
var val = this.state.editText.trim();
if (val) {
this.props.onSave(val);
......@@ -23,7 +20,6 @@ var app = app || {};
} else {
this.props.onDestroy();
}
return false;
},
handleEdit: function () {
......@@ -42,9 +38,9 @@ var app = app || {};
handleKeyDown: function (event) {
if (event.which === ESCAPE_KEY) {
this.setState({editText: this.props.todo.title});
this.props.onCancel();
this.props.onCancel(event);
} else if (event.which === ENTER_KEY) {
this.handleSubmit();
this.handleSubmit(event);
}
},
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment