site/examples/todo/js/lib/canjs/can.jquery.js
function (val) {
                        // create the fragment, but don't hook it up
                        // we need to insert it into the document first
                        var frag = can.view.frag(val, parentNode),
                            // keep a reference to each node
                            newNodes = can.makeArray(frag.childNodes),
                            last = nodes ? nodes[nodes.length - 1] : span;

                        // Insert it in the `document` or `documentFragment`
                        if (last.nextSibling) {
                            last.parentNode.insertBefore(frag, last.nextSibling);
                        } else {
                            last.parentNode.appendChild(frag);
                        }
                        // nodes hasn't been set yet
                        if (!nodes) {
                            can.remove(can.$(span));
                            nodes = newNodes;
                            // set the teardown nodeList
                            nodeList = nodes;
                            can.view.registerNode(nodes);
                        } else {
                            // Update node Array's to point to new nodes
                            // and then remove the old nodes.
                            // It has to be in this order for Mootools
                            // and IE because somehow, after an element
                            // is removed from the DOM, it loses its
                            // expando values.
                            var nodesToRemove = can.makeArray(nodes);
                            can.view.replace(nodes, newNodes);
                            can.remove(can.$(nodesToRemove));
                        }
                    }
function (val) {
                        // create the fragment, but don't hook it up
                        // we need to insert it into the document first
                        var frag = can.view.frag(val, parentNode),
                            // keep a reference to each node
                            newNodes = can.makeArray(frag.childNodes),
                            last = nodes ? nodes[nodes.length - 1] : span;

                        // Insert it in the `document` or `documentFragment`
                        if (last.nextSibling) {
                            last.parentNode.insertBefore(frag, last.nextSibling);
                        } else {
                            last.parentNode.appendChild(frag);
                        }
                        // nodes hasn't been set yet
                        if (!nodes) {
                            can.remove(can.$(span));
                            nodes = newNodes;
                            // set the teardown nodeList
                            nodeList = nodes;
                            can.view.registerNode(nodes);
                        } else {
                            // Update node Array's to point to new nodes
                            // and then remove the old nodes.
                            // It has to be in this order for Mootools
                            // and IE because somehow, after an element
                            // is removed from the DOM, it loses its
                            // expando values.
                            var nodesToRemove = can.makeArray(nodes);
                            can.view.replace(nodes, newNodes);
                            can.remove(can.$(nodesToRemove));
                        }
                    }
function ( val ) { // create the fragment, but don't hook it up // we need to insert it into the document first var frag = can . view . frag ( val , parentNode ) , // keep a reference to each node newNodes = can . makeArray ( frag . childNodes ) , last = nodes ? nodes [ nodes . length - 1 ] : span ; // Insert it in the `document` or `documentFragment` if ( last . nextSibling ) { last . parentNode . insertBefore ( frag , last . nextSibling ) ; } else { last . parentNode . appendChild ( frag ) ; } // nodes hasn't been set yet if ( ! nodes ) { can . remove ( can . $ ( span ) ) ; nodes = newNodes ; // set the teardown nodeList nodeList = nodes ; can . view . registerNode ( nodes ) ; } else { // Update node Array's to point to new nodes // and then remove the old nodes. // It has to be in this order for Mootools // and IE because somehow, after an element // is removed from the DOM, it loses its // expando values. var nodesToRemove = can . makeArray ( nodes ) ; can . view . replace ( nodes , newNodes ) ; can . remove ( can . $ ( nodesToRemove ) ) ; } }
A helper function to manage inserting the contents and removing the old contents
A helper function to manage inserting the contents and removing the old contents