Fixed calculation of positions in IE11
[GitHub/WoltLab/WCF.git] / wcfsetup / install / files / js / WoltLabSuite / Core / Ui / Redactor / Mention.js
index e2103f3e34511af6599f38aaeb12849d8b36d509..ae8c06301d9d889c7bb739e54531981cf7d886b1 100644 (file)
@@ -134,12 +134,12 @@ define(['Ajax', 'Environment', 'Ui/CloseOverlay'], function(Ajax, Environment, U
                        // get the offsets of the bounding box of current text selection
                        var rect = data.selection.getRangeAt(0).getBoundingClientRect();
                        var offsets = {
-                               top: Math.round(rect.bottom) + window.scrollY,
+                               top: Math.round(rect.bottom) + (window.scrollY || window.pageYOffset),
                                left: Math.round(rect.left) + document.body.scrollLeft
                        };
                        
                        if (this._lineHeight === null) {
-                               this._lineHeight = Math.round(rect.bottom - rect.top - window.scrollY);
+                               this._lineHeight = Math.round(rect.bottom - rect.top - (window.scrollY || window.pageYOffset));
                        }
                        
                        // restore caret position
@@ -311,14 +311,9 @@ define(['Ajax', 'Environment', 'Ui/CloseOverlay'], function(Ajax, Environment, U
                        
                        this._selectItem(0);
                        
-                       if (offset.top + this._dropdownMenu.offsetHeight + 10 > window.innerHeight + window.scrollY) {
-                               this._dropdownMenu.classList.add('dropdownArrowBottom');
-                               
+                       if (offset.top + this._dropdownMenu.offsetHeight + 10 > window.innerHeight + (window.scrollY || window.pageYOffset)) {
                                this._dropdownMenu.style.setProperty('top', offset.top - this._dropdownMenu.offsetHeight - 2 * this._lineHeight + 7 + 'px', '');
                        }
-                       else {
-                               this._dropdownMenu.classList.remove('dropdownArrowBottom');
-                       }
                },
                
                _selectItem: function(step) {