Feature #43356

Allow Fluid arrays only in ViewHelper arguments

Added by Sebastian Kurfuerst almost 9 years ago. Updated almost 9 years ago.

Status:
Resolved
Priority:
Should have
Category:
Core
Target version:
-
Start date:
2012-11-27
Due date:
% Done:

100%

Estimated time:
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

Related to TYPO3.Fluid - Feature #7608: Configurable shorthand/object accessor delimitersNew2010-05-03

Actions
Related to TYPO3.Fluid - Bug #44140: Unlucky JavaScript syntax can break inline tagsResolved2012-12-20

Actions
Has duplicate TYPO3.Fluid - Bug #45071: Fluid tries to parse inside an in-HTML Javascript codeClosed2013-02-01

Actions
#1

Updated by Sebastian Kurfuerst almost 9 years ago

  • Category set to Core
  • Status changed from New to Accepted
  • Assignee set to Sebastian Kurfuerst
  • % Done changed from 0 to 80
#2

Updated by Gerrit Code Review almost 9 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 almost 9 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 almost 9 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 almost 9 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 almost 9 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 80 to 100

Also available in: Atom PDF