Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在阅读Backbone教程并查看源代码我不理解双击事件(todo-view.js),这导致了编辑方法,这导致元素获取类“编辑”使元素(输入)可编辑。
这实际上是一个 CSS 技巧。输入元素默认隐藏:
.todo-list li .edit { display: none; }
然后在 dblclick 上,父li元素接收到editing该类,这使得输入通过另一个规则可见:
li
editing
.todo-list li.editing .edit { display: block; }