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

Side by Side Diff: chrome/common/jstemplate_builder.cc

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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/resources/extensions_ui.html ('k') | chrome/third_party/jstemplate/COPYING » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // A helper function for using JsTemplate. See jstemplate_builder.h for more 5 // A helper function for using JsTemplate. See jstemplate_builder.h for more
6 // info. 6 // info.
7 7
8 #include "chrome/common/jstemplate_builder.h" 8 #include "chrome/common/jstemplate_builder.h"
9 9
10 #include "app/resource_bundle.h" 10 #include "app/resource_bundle.h"
(...skipping 25 matching lines...) Expand all
36 serializer.Serialize(*json); 36 serializer.Serialize(*json);
37 // </ confuses the HTML parser because it could be a </script> tag. So we 37 // </ confuses the HTML parser because it could be a </script> tag. So we
38 // replace </ with <\/. The extra \ will be ignored by the JS engine. 38 // replace </ with <\/. The extra \ will be ignored by the JS engine.
39 ReplaceSubstringsAfterOffset(&jstext, 0, "</", "<\\/"); 39 ReplaceSubstringsAfterOffset(&jstext, 0, "</", "<\\/");
40 40
41 std::string output(html_template.data(), html_template.size()); 41 std::string output(html_template.data(), html_template.size());
42 output.append("<script>"); 42 output.append("<script>");
43 output.append(jstemplate_src.data(), jstemplate_src.size()); 43 output.append(jstemplate_src.data(), jstemplate_src.size());
44 output.append("var tp = document.getElementById('"); 44 output.append("var tp = document.getElementById('");
45 output.append(template_id.data(), template_id.size()); 45 output.append(template_id.data(), template_id.size());
46 output.append("'); var cx = new JsExprContext("); 46 output.append("'); var cx = new JsEvalContext(");
47 output.append(jstext); 47 output.append(jstext);
48 output.append("); jstProcess(cx, tp);</script>"); 48 output.append("); jstProcess(cx, tp);</script>");
49 49
50 return output; 50 return output;
51 } 51 }
52 52
53 } // namespace jstemplate_builder 53 } // namespace jstemplate_builder
OLDNEW
« no previous file with comments | « chrome/browser/resources/extensions_ui.html ('k') | chrome/third_party/jstemplate/COPYING » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698