bqw5189 / closure-templates

Automatically exported from code.google.com/p/closure-templates
Apache License 2.0
0 stars 0 forks source link

Problems when using a JavaScript reserved word as a param name #32

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

Call one template from another using the {call} tag with a {param} named 
"class" or "default" or another JavaScript reserved word.  Compile the 
resulting templates to JavaScript functions.

What is the expected output? What do you see instead?

The compiled templates produce a syntax error in IE and Safari due to the use 
of an unquoted reserved word as an object property name.

What version of the product are you using? On what operating system?

Soy version 20100708 on Ubuntu Linux, Windows 7, and Windows XP.  Browsers that 
demonstrate this issue are Safari 5 and IE8 on Windows 7, and IE7 on Windows XP.

Please provide any additional information below.

This issue can be fixed by quoting object property names in compiled JavaScript 
output.

Original issue reported on code.google.com by halle...@gmail.com on 6 Jan 2011 at 9:45

GoogleCodeExporter commented 9 years ago
An example of a problem call looks like this:

    {call .button}
        {param class: 'blue' /}
        {param default: false /}
    {/call}

Original comment by halle...@gmail.com on 6 Jan 2011 at 9:47

GoogleCodeExporter commented 9 years ago

Original comment by kai.hu...@gmail.com on 20 Sep 2011 at 12:08