Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(76)

Unified Diff: chrome/third_party/jstemplate/test/jstemplate_script.js

Issue 119384: Update JSTemplate to the latest version from Google Code (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/third_party/jstemplate/test/jstemplate_script.js
===================================================================
--- chrome/third_party/jstemplate/test/jstemplate_script.js (revision 17821)
+++ chrome/third_party/jstemplate/test/jstemplate_script.js (working copy)
@@ -1,80 +0,0 @@
-// Copyright 2006 Google
-/**
- * @pageoverview Some logic for the jstemplates test pages.
- *
- * @author Steffen Meschkat <mesch@google.com>
- */
-
-/**
- * Returns the element with the given ID
- *
- * @param {String} id The id of the element to return.
- * @param {Document} opt_context The context in which to search (optional).
- * @return {Element} The corresponding element.
- */
-function elem(id, opt_context) {
- if (opt_context && ownerDocument(opt_context)) {
- return ownerDocument(opt_context).getElementById(id);
- } else {
- return document.getElementById(id);
- }
-}
-
-/**
- * Wrapper for the eval() builtin function to evaluate expressions and
- * obtain their value. It wraps the expression in parentheses such
- * that object literals are really evaluated to objects. Without the
- * wrapping, they are evaluated as block, and create syntax
- * errors. Also protects against other syntax errors in the eval()ed
- * code and returns null if the eval throws an exception.
- *
- * @param {String} expr
- * @return {Object|Null}
- */
-function jsEval(expr) {
- try {
- // NOTE(mesch): An alternative idiom would be:
- //
- // eval('(' + expr + ')');
- //
- // Note that using the square brackets as below, "" evals to undefined.
- // The alternative of using parentheses does not work when evaluating
- // function literals in IE.
- // e.g. eval("(function() {})") returns undefined, and not a function
- // object, in IE.
- return eval('[' + expr + '][0]');
- } catch (e) {
- return null;
- }
-}
-
-/**
- * Initializer for interactive test: copies the value from the actual
- * template HTML into a text area to make the HTML source visible.
- */
-function jsinit() {
- elem('template').value = elem('tc').innerHTML;
-}
-
-
-/**
- * Interactive test.
- *
- * @param {Boolean} reprocess If true, reprocesses the output of the
- * previous invocation.
- */
-function jstest(reprocess) {
- var jstext = elem('js').value;
- var input = jsEval(jstext);
- var t;
- if (reprocess) {
- t = elem('out');
- } else {
- elem('tc').innerHTML = elem('template').value;
- t = jstGetTemplate('t');
- elem('out').innerHTML = '';
- elem('out').appendChild(t);
- }
- jstProcess(new JsExprContext(input), t);
- elem('html').value = elem('out').innerHTML;
-}
« no previous file with comments | « chrome/third_party/jstemplate/test/jstemplate.html ('k') | chrome/third_party/jstemplate/tutorial_examples/01-quick.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698