[BUGFIX] Access parent element in Element Browser correctly 11/55511/9
authorAndreas Fernandez <a.fernandez@scripting-base.de>
Wed, 31 Jan 2018 15:01:00 +0000 (16:01 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Sun, 4 Feb 2018 17:43:50 +0000 (18:43 +0100)
When the element browser is opened in a popup window, the parent element
(=popup) is now accessed properly.

This patch also fixes the case for `list_frame` which didn't work in
Firefox.

Resolves: #83693
Releases: master
Change-Id: I2436942a239b868cd1e3e269c6161a9df92e05ff
Reviewed-on: https://review.typo3.org/55511
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Mathias Schreiber <mathias.schreiber@typo3.com>
Tested-by: Mathias Schreiber <mathias.schreiber@typo3.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/recordlist/Resources/Public/JavaScript/ElementBrowser.js

index ef1680b..114f4c8 100644 (file)
@@ -87,23 +87,27 @@ define([
                if (
                        typeof window.parent !== 'undefined' &&
                        typeof window.parent.document.list_frame !== 'undefined' &&
-                       window.parent.document.activeElement.classList.contains('t3js-modal-iframe')
+                       window.parent.document.list_frame.parent.document.querySelector('.t3js-modal-iframe') !== null
                ) {
                        opener = window.parent.document.list_frame;
-               }
-               else if (
+               } else if (
+                       typeof window.parent !== 'undefined' &&
+                       typeof window.parent.frames.list_frame !== 'undefined' &&
+                       window.parent.frames.list_frame.parent.document.querySelector('.t3js-modal-iframe') !== null
+               ) {
+                       opener = window.parent.frames.list_frame;
+               } else if (
                        typeof window.frames !== 'undefined' &&
                        typeof window.frames.frameElement !== 'undefined' &&
                        window.frames.frameElement !== null &&
                        window.frames.frameElement.classList.contains('t3js-modal-iframe')
                ) {
-                       opener = window.frames.parent.frames.list_frame;
-               }
-               else if (window.opener) {
-                       opener = window.opener
+                       opener = window.frames.frameElement.contentWindow.parent;
+               } else if (window.opener) {
+                       opener = window.opener;
                }
                return opener;
-       }
+       };
 
        /**
         *