SecureHandlebars 自动应用上下文相关的 XSS 输出过滤,以防止 XSS。
示例代码:
', data = {title: 'Hello'}; // analyze the HTML contexts, and return a handlebars template with context-sensitive helpers added var template = Handlebars.compile(html); // html is 'Hello ' var html = template(data); // inserts the html to the DOM// ...