0

I'm going through Backbone tutorial and looking through the source code I don't understand the the doubleclicking event (todo-view.js), which leads to the edit method, which leads to the element getting the class 'editing' make the element (input) editable.

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
akantoword
  • 2,824
  • 8
  • 26
  • 43

1 Answers1

2

That is actually a CSS trick. The input element is hidden by default:

.todo-list li .edit {
    display: none;
}

Then on dblclick the parent li element receives the editing class, and that makes the input visible with another rule:

.todo-list li.editing .edit {
    display: block;
}
Emile Bergeron
  • 17,074
  • 5
  • 83
  • 129
Yura
  • 2,690
  • 26
  • 32