[BUGFIX] Add correctly escaped css selectors for js 22/28522/5
authorDaniel Alder <dalder@snowflake.ch>
Wed, 19 Mar 2014 13:37:44 +0000 (14:37 +0100)
committerMarkus Klein <klein.t3@mfc-linz.at>
Wed, 26 Mar 2014 21:03:55 +0000 (22:03 +0100)
Because identifiers in css are using escaped entries, we
have to do another escaping for the javascript selectors.

Resolves: #56874
Releases: 6.2
Change-Id: Ie470def83409904963e8b6e89635a6734bc4088c
Reviewed-on: https://review.typo3.org/28522
Reviewed-by: Pascal Dürsteler
Tested-by: Pascal Dürsteler
Reviewed-by: Markus Klein
Tested-by: Markus Klein
typo3/sysext/backend/Resources/Public/JavaScript/jsfunc.inline.js

index beac3bb..3f768ed 100644 (file)
@@ -475,6 +475,8 @@ var inline = {
 
                var elName = this.parseObjectId('full', objectId, 2, 0, true);
 
+               var escapeSelectorObjectId = this.escapeSelectorObjectId(objectId);
+
                formObj = $$('[name="' + elName + '[hidden]_0"]');
                valueObj = $$('[name="' + elName + '[hidden]"]');
 
@@ -499,7 +501,7 @@ var inline = {
                }
 
                        // remove loading-indicator
-               TYPO3.jQuery('#' + objectId + '_loadingbar').remove();
+               TYPO3.jQuery('#' + escapeSelectorObjectId + '_loadingbar').remove();
 
                        // now that the content is loaded, set the expandState
                this.expandCollapseRecord(objectId, expandSingle);
@@ -1239,9 +1241,23 @@ var inline = {
        escapeObjectId: function(objectId) {
                var escapedObjectId;
                escapedObjectId = objectId.replace(/:/g, '\\:');
-               escapedObjectId = objectId.replace(/\./g, '\\.');
+               escapedObjectId = escapedObjectId.replace(/\./g, '\\.');
                return escapedObjectId;
-       }
+       },
+
+       /**
+        * Escapes object identifiers to be used as jQuery selector.
+        *
+        * @param string objectId
+        * @return string
+        */
+       escapeSelectorObjectId: function(objectId) {
+               var escapedSelectorObjectId;
+               var escapedObjectId = this.escapeObjectId(objectId);
+               escapedSelectorObjectId = escapedObjectId.replace(/\\:/g, '\\\\\\:');
+               escapedSelectorObjectId = escapedSelectorObjectId.replace(/\\\./g, '\\\\\\.');
+               return escapedSelectorObjectId;
+       },
 }
 
 Object.extend(Array.prototype, {