Bug #38871

Generating links within script tags gives invalid documents

Added by Jost Baron over 8 years ago. Updated over 7 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
ViewHelpers
Target version:
-
Start date:
2012-07-11
Due date:
% Done:

0%

Has patch:
No

Description

When generating a link in a fluid template, which is enclosed by script-Tags to a given format, the ampersands are not escaped.

So
<script type="text/javascript">
var link = '{f:uri.action(action: 'someAction')}';
</script>
generates a link like this:

index.php?id=123&tx_ext_pi1[controller]=SomeController&tx_ext_pi1[action]=someAction&cHash=foobar

This is invalid XHTML (even inside a script, according to the W3C-Validator), as the ampersands are literals. The same thing works fine outside of script tags.

History

#1 Updated by Adrian Föder over 7 years ago

  • Status changed from New to Closed

Jost,

I just tried in in Flow context and it doesn't encode the ampersands since it's not necessary in plain HTML (non-xhtml). If you need to encode the ampersand anyways, add the format.htmlentities ViewHelper just like this:

{f:uri.action(action: 'someAction') -> f:format.htmlentities()}

Don't hesitate to reopen if you don't agree or if extbase is still affected with it.

Also available in: Atom PDF