[BUGFIX] Escape element ID before used in jQuery selector 77/33777/3
authorRoland Waldner <mostwantedtypo3@gmail.com>
Tue, 4 Nov 2014 08:54:47 +0000 (09:54 +0100)
committerAlexander Opitz <opitz.alexander@googlemail.com>
Mon, 1 Dec 2014 13:47:52 +0000 (14:47 +0100)
General information: to use any of the meta-characters as a
literal part of a jQuery selector, it must be escaped with
two backslashes: http://api.jquery.com/category/selectors/

Using IRRE (TCA type "inline") in Flexforms, TYPO3 may
generate HTML elements with IDs containing dots. Example:

id="data-104-tt_content-182-pi_flexform---data---fileSelection
---lDEF---settings.fileSelection.files---vDEF_records"

If you set "useSortable" and "endableControls.dragdrop" to 1
for an element in your Flexform configuration,
inline.createDragAndDropSorting(objectId) will get called for
that element. This objectId has to be escaped to be used as a
literal part of a jQuery selector later in this function.
Otherwise the drag-and-drop functionality will fail.

Resolves: #62676
Related: #62001
Releases: 6.2
Change-Id: I353a699d82885b7bd57d0dc5fafbb8f5646d693f
Reviewed-on: http://review.typo3.org/33777
Reviewed-by: Stefan Busemann <stefan.busemann@in2code.de>
Reviewed-by: Markus Klein <klein.t3@reelworx.at>
Tested-by: Markus Klein <klein.t3@reelworx.at>
Reviewed-by: Alexander Opitz <opitz.alexander@googlemail.com>
Tested-by: Alexander Opitz <opitz.alexander@googlemail.com>
typo3/sysext/backend/Resources/Public/JavaScript/jsfunc.inline.js

index b869f71..6b42764 100644 (file)
@@ -626,7 +626,7 @@ var inline = {
 
        createDragAndDropSorting: function(objectId) {
                require(['jquery','jquery-ui/jquery-ui-1.10.4.custom.min'], function($) {
-                       var $sortingContainer = $('#' + objectId);
+                       var $sortingContainer = $('#' + inline.escapeObjectId(objectId));
 
                        if ($sortingContainer.hasClass('ui-sortable')) {
                                $sortingContainer.sortable('enable');
@@ -651,11 +651,11 @@ var inline = {
 
        destroyDragAndDropSorting: function(objectId) {
                require(['jquery','jquery-ui/jquery-ui-1.10.4.custom.min'], function($) {
-                       var $sortingContainer = $('#' + objectId);
+                       var $sortingContainer = $('#' + inline.escapeObjectId(objectId));
                        if (!$sortingContainer.hasClass('ui-sortable')) {
                                return;
                        }
-                       $('#' + objectId).sortable('disable');
+                       $('#' + inline.escapeObjectId(objectId)).sortable('disable');
                });
        },