Issues

ZF-8093: Remove HTML comments from HeadScript

Description

Taking use of comments to escape JavaScript content is old and unnecessary. All JavaScript-enabled browsers don't require the escaping of JavaScript (or any other language) inside of the

So removing "//" wouldn't break any applications written with Zend Framework.

HTML5 explicitly says

Comments

Having this code in there causes no problems but removing it could cause problems with older browsers.

@Jon: I disagree. The comments do cause problems if you try to use a scripting language which doesn't use {{//}} for comments. I cannot, for example, use CoffeeScript in this manner as line comments start with {{#}}.

I propose making the comment start ({{//}}) editable via mutators so those of us who want to use other languages or adhere to the HTML5 spec can do so.

I would like to reopen this issue as these comments bit me when I needed a script tag with a jquery template as the type/content... The // and // will then be seen as part of the template and render incorrectly.

I propose to have an option to disable this automatic escaping of the script. It should default to the current behavior...

something like an '_disableScriptEscape' property (perhaps set/read in the same way as the setAllowArbitraryAttributes and arbitraryAttributesAllowed methods) although it should not be a 'global' instruction for all script tags, just the current one added...