def testEscapeJSIfNeeded(self): self.assertEqual( '<script>var foo;<\/script>', js_utils.EscapeJSIfNeeded('<script>var foo;</script>')) self.assertEqual( '<script>var foo;<\/script>', js_utils.EscapeJSIfNeeded('<script>var foo;<\/script>'))
def AppendJSContentsToFile(self, f, use_include_tags_for_scripts, dir_for_include_tag_root): """Appends the js for this module to the provided file.""" for dependent_raw_script in self.dependent_raw_scripts: if use_include_tags_for_scripts: rel_filename = os.path.relpath(dependent_raw_script.filename, dir_for_include_tag_root) f.write("""<include src="%s">\n""" % rel_filename) else: f.write( js_utils.EscapeJSIfNeeded(dependent_raw_script.contents)) f.write('\n')
def AppendJSContentsToFile(self, f, use_include_tags_for_scripts, dir_for_include_tag_root): super(HTMLModule, self).AppendJSContentsToFile(f, use_include_tags_for_scripts, dir_for_include_tag_root) for inline_script in self._parser_results.inline_scripts: js = inline_script.contents js = js_utils.EscapeJSIfNeeded(js) f.write(js) f.write('\n')
def AppendJSContentsToFile(self, f, use_include_tags_for_scripts, dir_for_include_tag_root): raw_script = self.loaded_raw_script if use_include_tags_for_scripts: rel_filename = os.path.relpath(raw_script.filename, dir_for_include_tag_root) f.write("""<include src="%s">\n""" % rel_filename) else: f.write(js_utils.EscapeJSIfNeeded(raw_script.contents)) f.write('\n')
def AppendJSContentsToFile(self, f, use_include_tags_for_scripts, dir_for_include_tag_root): super(HTMLModule, self).AppendJSContentsToFile(f, use_include_tags_for_scripts, dir_for_include_tag_root) for inline_script in self._parser_results.inline_scripts: if not HasPolymerCall(inline_script.stripped_contents): js = inline_script.contents else: js = GetInlineScriptContentWithPolymerizingApplied( inline_script) js = js_utils.EscapeJSIfNeeded(js) f.write(js) f.write('\n')
def AppendJSContentsToFile(self, f, *args, **kwargs): js = self.contents escaped_js = js_utils.EscapeJSIfNeeded(js) f.write(escaped_js) f.write('\n')