site/examples/todo/js/lib/canjs/can.jquery.js
function (span, parentNode) {
                    // updates the elements with the new content
                    update = function (newVal) {
                        // is this still part of the DOM?
                        var attached = nodes[0].parentNode;
                        // update the nodes in the DOM with the new rendered value
                        if (attached) {
                            makeAndPut(newVal);
                        }
                        teardownCheck(nodes[0].parentNode);
                    };

                    // make sure we have a valid parentNode
                    parentNode = getParentNode(span, parentNode);
                    // A helper function to manage inserting the contents
                    // and removing the old contents
                    var nodes, makeAndPut = 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));
                        }
                    };
                    // nodes are the nodes that any updates will replace
                    // at this point, these nodes could be part of a documentFragment
                    makeAndPut(binding.value, [span]);

                    setupTeardownOnDestroy(parentNode);
                    //children have to be properly nested HTML for buildFragment to work properly
                }
function (span, parentNode) {
                    // updates the elements with the new content
                    update = function (newVal) {
                        // is this still part of the DOM?
                        var attached = nodes[0].parentNode;
                        // update the nodes in the DOM with the new rendered value
                        if (attached) {
                            makeAndPut(newVal);
                        }
                        teardownCheck(nodes[0].parentNode);
                    };

                    // make sure we have a valid parentNode
                    parentNode = getParentNode(span, parentNode);
                    // A helper function to manage inserting the contents
                    // and removing the old contents
                    var nodes, makeAndPut = 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));
                        }
                    };
                    // nodes are the nodes that any updates will replace
                    // at this point, these nodes could be part of a documentFragment
                    makeAndPut(binding.value, [span]);

                    setupTeardownOnDestroy(parentNode);
                    //children have to be properly nested HTML for buildFragment to work properly
                }
function ( span , parentNode ) { // updates the elements with the new content update = function ( newVal ) { // is this still part of the DOM? var attached = nodes [ 0 ] . parentNode ; // update the nodes in the DOM with the new rendered value if ( attached ) { makeAndPut ( newVal ) ; } teardownCheck ( nodes [ 0 ] . parentNode ) ; } ; // make sure we have a valid parentNode parentNode = getParentNode ( span , parentNode ) ; // A helper function to manage inserting the contents // and removing the old contents var nodes , makeAndPut = 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 ) ) ; } } ; // nodes are the nodes that any updates will replace // at this point, these nodes could be part of a documentFragment makeAndPut ( binding . value , [ span ] ) ; setupTeardownOnDestroy ( parentNode ) ; //children have to be properly nested HTML for buildFragment to work properly }
If we are not escaping, replace the parentNode with a documentFragment created as with `func`'s return value.
If we are not escaping replace the parentNode with a documentFragment created as with func s return value .