examples/todo/js/modules/list.js
function(id, title, isCompleted) {
			var todoTemplateEl = moduleEl.querySelector('.todo-template-container li'),
				newTodoEl = todoTemplateEl.cloneNode(true);

			// Set the label of the todo
			newTodoEl.querySelector('label').textContent = title;
			newTodoEl.setAttribute('data-todo-id', id);
			if (isCompleted) {
				newTodoEl.classList.add('completed');
				newTodoEl.querySelector('input[type="checkbox"]').checked = true;
			}

			return newTodoEl;
		}
function(id, title, isCompleted) {
			var todoTemplateEl = moduleEl.querySelector('.todo-template-container li'),
				newTodoEl = todoTemplateEl.cloneNode(true);

			// Set the label of the todo
			newTodoEl.querySelector('label').textContent = title;
			newTodoEl.setAttribute('data-todo-id', id);
			if (isCompleted) {
				newTodoEl.classList.add('completed');
				newTodoEl.querySelector('input[type="checkbox"]').checked = true;
			}

			return newTodoEl;
		}
function ( id , title , isCompleted ) { var todoTemplateEl = moduleEl . querySelector ( '.todo-template-container li' ) , newTodoEl = todoTemplateEl . cloneNode ( true ) ; // Set the label of the todo newTodoEl . querySelector ( 'label' ) . textContent = title ; newTodoEl . setAttribute ( 'data-todo-id' , id ) ; if ( isCompleted ) { newTodoEl . classList . add ( 'completed' ) ; newTodoEl . querySelector ( 'input[type="checkbox"]' ) . checked = true ; } return newTodoEl ; }
Creates a list item for a todo based off of a template
@param {number} id The id of the todo
@param {string} title The todo label
@param {boolean} isCompleted Is todo complete
@returns {Node}
Creates a list item for a todo based off of a template