<commit_before>import React, { Component } from 'react'

class TodoItem extends Component {
  
  // 处理完成单个任务、是否完成
  handlerChange (evt) {
    let isDone = this.props.isDone
    this.props.changeTodoState(this.props.index, !isDone)
    evt.preventDefault()
    evt.stopPropagation()
  }
  
  // 删除任务
  handlerDel (evt) {
    this.props.delTodo(this.props.index)
    evt.preventDefault()
    evt.stopPropagation()
  }
  
  // 鼠标移入
  handlerMouseOver () {
    this.refs.deleteBtn.style.display = "inline"
  }
  
  // 鼠标移出
  handlerMouseOut () {
    this.refs.deleteBtn.style.display = "none"
  }
  
  render () {
    let doneStyle = this.props.isDone ? {textDecoration: 'line-through'} : {textDecoration: 'none'}
    
    return (
      <li
        onMouseOver={this.handlerMouseOver.bind(this)}
        onMouseOut={this.handlerMouseOut.bind(this)}
        onClick={this.handlerChange.bind(this)}
      >
          <input type="checkbox" checked={this.props.isDone} onChange={this.handlerChange.bind(this)}/>
          <div className="label" style={doneStyle}>{this.props.text}</div>
          <div className="action">
            <button type="button" className="btn" ref="deleteBtn" onClick={this.handlerDel.bind(this)}>删除</button>
          </div>
      </li>
    )
  }
}

export default TodoItem<commit_msg>去除默认行为带来的bug<commit_after>import React, { Component } from 'react'

class TodoItem extends Component {
  
  // 处理完成单个任务、是否完成
  handlerChange () {
    let isDone = this.props.isDone
    this.props.changeTodoState(this.props.index, !isDone)
  }
  
  // 删除任务
  handlerDel (evt) {
    this.props.delTodo(this.props.index)
    evt.preventDefault()
    evt.stopPropagation()
  }
  
  // 鼠标移入
  handlerMouseOver () {
    this.refs.deleteBtn.style.display = "inline"
  }
  
  // 鼠标移出
  handlerMouseOut () {
    this.refs.deleteBtn.style.display = "none"
  }
  
  render () {
    let doneStyle = this.props.isDone ? {textDecoration: 'line-through'} : {textDecoration: 'none'}
    
    return (
      <li
        onMouseOver={this.handlerMouseOver.bind(this)}
        onMouseOut={this.handlerMouseOut.bind(this)}
      >
        <div><input type="checkbox" checked={this.props.isDone} onChange={this.handlerChange.bind(this)}/></div>
        <div className="label" style={doneStyle} onClick={this.handlerChange.bind(this)}>{this.props.text}</div>
        <div className="action">
          <button type="button" className="btn" ref="deleteBtn" onClick={this.handlerDel.bind(this)}>删除</button>
        </div>
      </li>
    )
  }
}

export default TodoItem
{'fraction_non_alphanumeric': 0.14682850430696945, 'fraction_numerical': 0.0, 'mean_word_length': 2.942901234567901, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1432176', 'n_tokens_mistral': 885, 'n_tokens_neox': 921, 'n_words': 126}