site/examples/todo/js/lib/canjs/can.jquery.js
function (url, async) {
            var suffix = url.match(/\.[\w\d]+$/),
                type,
                // If we are reading a script element for the content of the template,
                // `el` will be set to that script element.
                el,
                // A unique identifier for the view (used for caching).
                // This is typically derived from the element id or
                // the url for the template.
                id,
                // The ajax request used to retrieve the template content.
                jqXHR;

            //If the url has a #, we assume we want to use an inline template
            //from a script element and not current page's HTML
            if (url.match(/^#/)) {
                url = url.substr(1);
            }
            // If we have an inline template, derive the suffix from the `text/???` part.
            // This only supports `<script>` tags.
            if (el = document.getElementById(url)) {
                suffix = "." + el.type.match(/\/(x\-)?(.+)/)[2];
            }

            // If there is no suffix, add one.
            if (!suffix && !$view.cached[url]) {
                url += (suffix = $view.ext);
            }

            if (can.isArray(suffix)) {
                suffix = suffix[0]
            }

            // Convert to a unique and valid id.
            id = $view.toId(url);

            // If an absolute path, use `steal` to get it.
            // You should only be using `//` if you are using `steal`.
            if (url.match(/^\/\//)) {
                var sub = url.substr(2);
                url = !window.steal ? sub : steal.config().root.mapJoin(sub);
            }

            // Set the template engine type.
            type = $view.types[suffix];

            // If it is cached,
            if ($view.cached[id]) {
                // Return the cached deferred renderer.
                return $view.cached[id];

                // Otherwise if we are getting this from a `<script>` element.
            } else if (el) {
                // Resolve immediately with the element's `innerHTML`.
                return $view.registerView(id, el.innerHTML, type);
            } else {
                // Make an ajax request for text.
                var d = new can.Deferred();
                can.ajax({
                    async: async,
                    url: url,
                    dataType: "text",
                    error: function (jqXHR) {
                        checkText("", url);
                        d.reject(jqXHR);
                    },
                    success: function (text) {
                        // Make sure we got some text back.
                        checkText(text, url);
                        $view.registerView(id, text, type, d)
                    }
                });
                return d;
            }
        }
function (url, async) {
            var suffix = url.match(/\.[\w\d]+$/),
                type,
                // If we are reading a script element for the content of the template,
                // `el` will be set to that script element.
                el,
                // A unique identifier for the view (used for caching).
                // This is typically derived from the element id or
                // the url for the template.
                id,
                // The ajax request used to retrieve the template content.
                jqXHR;

            //If the url has a #, we assume we want to use an inline template
            //from a script element and not current page's HTML
            if (url.match(/^#/)) {
                url = url.substr(1);
            }
            // If we have an inline template, derive the suffix from the `text/???` part.
            // This only supports `<script>` tags.
            if (el = document.getElementById(url)) {
                suffix = "." + el.type.match(/\/(x\-)?(.+)/)[2];
            }

            // If there is no suffix, add one.
            if (!suffix && !$view.cached[url]) {
                url += (suffix = $view.ext);
            }

            if (can.isArray(suffix)) {
                suffix = suffix[0]
            }

            // Convert to a unique and valid id.
            id = $view.toId(url);

            // If an absolute path, use `steal` to get it.
            // You should only be using `//` if you are using `steal`.
            if (url.match(/^\/\//)) {
                var sub = url.substr(2);
                url = !window.steal ? sub : steal.config().root.mapJoin(sub);
            }

            // Set the template engine type.
            type = $view.types[suffix];

            // If it is cached,
            if ($view.cached[id]) {
                // Return the cached deferred renderer.
                return $view.cached[id];

                // Otherwise if we are getting this from a `<script>` element.
            } else if (el) {
                // Resolve immediately with the element's `innerHTML`.
                return $view.registerView(id, el.innerHTML, type);
            } else {
                // Make an ajax request for text.
                var d = new can.Deferred();
                can.ajax({
                    async: async,
                    url: url,
                    dataType: "text",
                    error: function (jqXHR) {
                        checkText("", url);
                        d.reject(jqXHR);
                    },
                    success: function (text) {
                        // Make sure we got some text back.
                        checkText(text, url);
                        $view.registerView(id, text, type, d)
                    }
                });
                return d;
            }
        }
function ( url , async ) { var suffix = url . match ( / \.[\w\d]+$ / ) , type , // If we are reading a script element for the content of the template, // `el` will be set to that script element. el , // A unique identifier for the view (used for caching). // This is typically derived from the element id or // the url for the template. id , // The ajax request used to retrieve the template content. jqXHR ; //If the url has a #, we assume we want to use an inline template //from a script element and not current page's HTML if ( url . match ( / ^# / ) ) { url = url . substr ( 1 ) ; } // If we have an inline template, derive the suffix from the `text/???` part. // This only supports `<script>` tags. if ( el = document . getElementById ( url ) ) { suffix = "." + el . type . match ( / \/(x\-)?(.+) / ) [ 2 ] ; } // If there is no suffix, add one. if ( ! suffix && ! $view . cached [ url ] ) { url += ( suffix = $view . ext ) ; } if ( can . isArray ( suffix ) ) { suffix = suffix [ 0 ] } // Convert to a unique and valid id. id = $view . toId ( url ) ; // If an absolute path, use `steal` to get it. // You should only be using `//` if you are using `steal`. if ( url . match ( / ^\/\/ / ) ) { var sub = url . substr ( 2 ) ; url = ! window . steal ? sub : steal . config ( ) . root . mapJoin ( sub ) ; } // Set the template engine type. type = $view . types [ suffix ] ; // If it is cached, if ( $view . cached [ id ] ) { // Return the cached deferred renderer. return $view . cached [ id ] ; // Otherwise if we are getting this from a `<script>` element. } else if ( el ) { // Resolve immediately with the element's `innerHTML`. return $view . registerView ( id , el . innerHTML , type ) ; } else { // Make an ajax request for text. var d = new can . Deferred ( ) ; can . ajax ( { async : async , url : url , dataType : "text" , error : function ( jqXHR ) { checkText ( "" , url ) ; d . reject ( jqXHR ) ; } , success : function ( text ) { // Make sure we got some text back. checkText ( text , url ) ; $view . registerView ( id , text , type , d ) } } ) ; return d ; } }
Makes sure there's a template, if not, have `steal` provide a warning.
Makes sure there s a template if not have steal provide a warning .