Feature #43356
Allow Fluid arrays only in ViewHelper arguments
Status: | Resolved | Start date: | 2012-11-27 | |
---|---|---|---|---|
Priority: | Should have | Due date: | ||
Assigned To: | Sebastian Kurfuerst | % Done: | 100% |
|
Category: | Core | |||
Target version: | - | |||
Has patch: | No |
Description
Allow Fluid arrays only in ViewHelper arguments
The following proposal would greatly enhance JavaScript compatibility:
Fluid Arrays are a subset of the JavaScript object syntax, making it
hard to work with them in mixed HTML/JavaScript documents. For example
before this change, the following JavaScript Object was parsed by Fluid:
var uris = {
endPoint1: '{f:uri.action(…)}',
endPoint2: '{f:uri.action(…)}',
};
Before this change, the above snippet resulted in the following template, as the generated array was casted to a string:
var uris = Array
With this change, Fluid only parses arrays which are used inside
ViewHelper arguments, such that an array inside normal text is not
converted anymore.
Breaking Change¶
This change is only breaking in very rare cases where one relied on
the inner contents of the ViewHelper being an array, f.e. if one used
the debug ViewHelper as follows:
<f:debug>{key1: 'value1', key2: 'value2'}</f:debug>
… or if anybody wrote custom ViewHelpers which use this convention.
Relying on that would be very fragile anyways, as the insertion of a
single space character before the opening curly bracket or after the
closing one would cast the array back to a string.
ViewHelpers which were written like this should be re-written to take
the array as ViewHelper argument:
<f:debug value="{key1: 'value1', key2: 'value2'}" />
Related issues
Associated revisions
[!!!][FEATURE] Allow Fluid arrays only in ViewHelper arguments
This change greatly enhances the JavaScript compatibility of Fluid.
Fluid Arrays are a subset of the JavaScript object syntax, making it
hard to work with them in mixed HTML/JavaScript documents. For example
before this change, the following JavaScript Object was parsed by Fluid::
var uris = {
endPoint1: '{f:uri.action(…)}',
endPoint2: '{f:uri.action(…)}',
};
Before this change, the above snippet resulted in the following template,
as the generated array was casted to a string:
var uris = Array
With this change, Fluid only parses arrays which are used inside
ViewHelper arguments, such that an array inside normal text is not
converted anymore.
Breaking Change ===============
This change is only breaking in very rare cases where one relied on
the inner contents of the ViewHelper being an array, f.e. if one used
the debug ViewHelper as follows::
<f:debug>{key1: 'value1', key2: 'value2'}</f:debug>
… or if anybody wrote custom ViewHelpers which use this convention.
Relying on that would be very fragile anyways, as the insertion of a
single space character before the opening curly bracket or after the
closing one would cast the array back to a string.
ViewHelpers which were written like this should be re-written to take
the array as ViewHelper argument::
<f:debug value="{key1: 'value1', key2: 'value2'}" />
Change-Id: I5a54a50dd1bb365486c6f59efcb966dc4e441c79
Resolves: #43356
Releases: 1.2
History
#1 Updated by Sebastian Kurfuerst over 2 years ago
- Category set to Core
- Status changed from New to Accepted
- Assigned To set to Sebastian Kurfuerst
- % Done changed from 0 to 80
#2 Updated by Gerrit Code Review over 2 years ago
- Status changed from Accepted to Under Review
Patch set 1 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/16818
#3 Updated by Gerrit Code Review over 2 years ago
Patch set 2 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/16818
#4 Updated by Gerrit Code Review over 2 years ago
Patch set 3 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/16818
#5 Updated by Gerrit Code Review over 2 years ago
Patch set 4 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/16818
#6 Updated by Sebastian Kurfuerst over 2 years ago
- Status changed from Under Review to Resolved
- % Done changed from 80 to 100
Applied in changeset ba09ec53d0fc932e4d65a4acfd925398e058b37e.