ZF-8093: Remove HTML comments from HeadScript

Issue Type: Improvement Created: 2009-10-18T08:41:58.000+0000 Last Updated: 2012-06-14T17:26:55.000+0000 Status: Closed Fix version(s): Reporter: Fabian Grutschus (crash) Assignee: Frank Br├╝ckner (frosch) Tags: - Zend_View

Related issues: - ZF-12287



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


Posted by Jon Whitcraft (sidhighwind) on 2009-11-20T13:08:02.000+0000

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

Posted by Taeber Rapczak (taeber) on 2011-05-12T15:21:31.000+0000

@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.

Posted by Bas K (bas) on 2011-08-15T20:08:05.000+0000

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...

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.