// A templated widget, mostly the same as dijit/_Templated, but without deprecated features in it.
// bindings: Object
// The data binding declaration for child widgets.
bindings:null,
startup:function(){
// Code to support childBindings property in dojox/mvc/WidgetList, etc.
// This implementation makes sure childBindings is set before this widget starts up, as dijit/_WidgetsInTemplatedMixin starts up child widgets before it starts itself up.
// A widgets-in-template widget that composes the application UI of TodoMVC (Dojo 1.8 version).
// Also, this class inherits todo/_CssToggleMixin so that it can react to change in "present"/"complete" attributes and add/remove CSS class to the root DOM node of this widget.
...
...
@@ -49,7 +49,6 @@ define([
// See documentation for dijit/_WidgetBase.startup() for more details.
// Kicks off instantiation of this controller, in a similar manner as dijit/_WidgetBase.postscript().
// params: Object?
// The optional parameters for this controller.
// srcNodeRef: DOMNode?
// The DOM node declaring this controller. Set if this controller is created via Dojo parser.
this.inherited(arguments);
srcNodeRef&&srcNodeRef.setAttribute("widgetId",this.id);// If this is created via Dojo parser, set widgetId attribute so that destroyDescendants() of parent widget works
},
startup:function(){
// summary:
// A function called after the DOM fragment declaring this controller is added to the document, in a similar manner as dijit/_WidgetBase.startup().
// A mix-in class for widgets-in-template for todo item, that looks at URL hash and completed state of todo item, and updates the hidden state.
// description:
// Defines data bindings for uniqueId/completed, and the mapping between several widget attributes to CSS classes (using todo/_CssToggleMixin).
// Also, looks at URL hash and completed state of todo item, and updates the hidden state. A todo item should be hidden if:
// A todo item should be hidden if:
//
// - URL hash is "/active" and the todo item is complete -OR-
// - URL hash is "/copleted" and the todo item is incomplete
// _setStrikeAttr: Object
// A object used by todo/_CssToggleMixin to reflect true/false state of "strike" attribute to existence of "completed" CSS class in this widget's root DOM.
// A object used by todo/_CssToggleMixin to reflect true/false state of "hidden" attribute to existence of "hidden" CSS class in this widget's root DOM.
this._set("completed",value);// Assign the new value to the attribute
},
startup:function(){
// summary:
// A function called after the DOM fragment declaring this controller is added to the document, in a similar manner as dijit/_WidgetBase.startup().
// description:
// Defines data binding for uniqueId/completed.
this.set("uniqueId",at(this.target,"uniqueId"));// Bind its uniqueId attribute to the data model for the todo item, so that the action handler for removing a todo item can specify which todo item should be removed
this.set("completed",at(this.target,"completed"));// Bind its completed attribute to the data model for the todo item, so that todo/ctrl/_HashCompletedMixin code can determine the shown/hidden state with the URL hash