Fixed calculation of positions in IE11
authorMarcel Werk <burntime@woltlab.com>
Mon, 14 Nov 2016 12:25:22 +0000 (13:25 +0100)
committerMarcel Werk <burntime@woltlab.com>
Mon, 14 Nov 2016 12:25:22 +0000 (13:25 +0100)
wcfsetup/install/files/js/WoltLabSuite/Core/Acp/Ui/Style/Editor.js
wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Alignment.js
wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Redactor/Mention.js

index 393204d92905e48dfb72ff99bcd7659b9c125d15..089c1b6f963af9bff04146adfe1c88c197c608fa 100644 (file)
@@ -136,7 +136,7 @@ define(['Ajax', 'Core', 'Dictionary', 'Dom/Util', 'EventHandler', 'Ui/Screen'],
                                var region = _stylePreviewRegions.get(lastValue);
                                var rect = region.getBoundingClientRect();
                                
-                               var top = rect.top + window.scrollY;
+                               var top = rect.top + (window.scrollY || window.pageYOffset);
                                
                                DomUtil.setStyles(_stylePreviewRegionMarker, {
                                        height: (region.clientHeight + 20) + 'px',
index d7c07558657c391a1697b0cd18c48f22d6ff0fa7..91c691abb61b11e78b00103a0f5e4f892cd1245d 100644 (file)
@@ -236,13 +236,13 @@ define(['Core', 'Language', 'Dom/Traverse', 'Dom/Util'], function(Core, Language
                        if (align === 'top') {
                                var bodyHeight = document.body.clientHeight;
                                bottom = (bodyHeight - refOffsets.top) + verticalOffset;
-                               if (bodyHeight - (bottom + elDimensions.height) < window.scrollY) {
+                               if (bodyHeight - (bottom + elDimensions.height) < (window.scrollY || window.pageYOffset)) {
                                        result = false;
                                }
                        }
                        else {
                                top = refOffsets.top + refDimensions.height + verticalOffset;
-                               if (top + elDimensions.height - window.scrollY > windowHeight) {
+                               if (top + elDimensions.height - (window.scrollY || window.pageYOffset) > windowHeight) {
                                        result = false;
                                }
                        }
index a5f0ece54e39a5a07a44bfe7fa17eecb984ea9e7..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,7 +311,7 @@ define(['Ajax', 'Environment', 'Ui/CloseOverlay'], function(Ajax, Environment, U
                        
                        this._selectItem(0);
                        
-                       if (offset.top + this._dropdownMenu.offsetHeight + 10 > window.innerHeight + window.scrollY) {
+                       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', '');
                        }
                },