Bug #38871

Generating links within script tags gives invalid documents

Added by Jost Baron 10 months ago. Updated 4 months ago.

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

0%

Category:ViewHelpers
Target version:-
Has patch:No FLOW3 version affected:(any)
Votes: 0

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

Updated by Adrian Föder 4 months 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