Replace document.body.scrollTop with window.scrollY
authorTim Düsterhus <duesterhus@woltlab.com>
Fri, 25 Mar 2016 18:58:11 +0000 (19:58 +0100)
committerTim Düsterhus <duesterhus@woltlab.com>
Fri, 25 Mar 2016 18:58:46 +0000 (19:58 +0100)
see 13d884839f750cc42a21c4b6c55dce5cf9229d0f

wcfsetup/install/files/js/WoltLab/WCF/Acp/Ui/Style/Editor.js
wcfsetup/install/files/js/WoltLab/WCF/Ui/Alignment.js
wcfsetup/install/files/js/WoltLab/WCF/Ui/Page/Header/Fixed.js
wcfsetup/install/files/js/WoltLab/WCF/Ui/Redactor/Mention.js
wcfsetup/install/files/js/WoltLab/WCF/Ui/Redactor/Quote.js

index 08b42edda5693cc5b94bc450e9c903cdedc9c245..c8729168dbd045d9b2d374713a00b030c1c1d760 100644 (file)
@@ -130,7 +130,7 @@ define(['Ajax', 'Dictionary', 'Dom/Util', 'EventHandler'], function(Ajax, Dictio
                                var region = _stylePreviewRegions.get(lastValue);
                                var rect = region.getBoundingClientRect();
                                
-                               var top = rect.top + document.body.scrollTop;
+                               var top = rect.top + window.scrollY;
                                
                                DomUtil.setStyles(_stylePreviewRegionMarker, {
                                        height: (region.clientHeight + 20) + 'px',
index 344d3199e4fda1c2029c38ff49799f3cbde27efa..87888f78b42ebae77e05e9584f419ecdca054611 100644 (file)
@@ -226,13 +226,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) < document.body.scrollTop) {
+                               if (bodyHeight - (bottom + elDimensions.height) < window.scrollY) {
                                        result = false;
                                }
                        }
                        else {
                                top = refOffsets.top + refDimensions.height + verticalOffset;
-                               if (top + elDimensions.height - document.body.scrollTop > windowHeight) {
+                               if (top + elDimensions.height - window.scrollY > windowHeight) {
                                        result = false;
                                }
                        }
index 6e512ee3c146fde680ad332a42d845717563216b..a0c8a437ef2e55dd888b1b87e1f6c40093a7eac1 100644 (file)
@@ -79,7 +79,7 @@ define(['Core', 'EventHandler', 'Ui/CloseOverlay', 'Ui/Screen', 'Ui/SimpleDropdo
                 * @protected
                 */
                _scroll: function() {
-                       _isFixed = (document.body.scrollTop > 50);
+                       _isFixed = (window.scrollY > 50);
                        
                        _pageHeader.classList[_isFixed ? 'add' : 'remove']('sticky');
                        _pageHeaderContainer.classList[_isFixed ? 'add' : 'remove']('stickyPageHeader');
index 9c8f43ece13e5e8a53bf758e3ee210579fbb6246..557aada9369cd35e250751695f5468b04255a672 100644 (file)
@@ -275,12 +275,12 @@ define(['Ajax', 'Environment', 'EventHandler', 'Ui/Alignment'], function(Ajax, E
                        // get the offsets of the bounding box of current text selection
                        var rect = selection.getRangeAt(0).getBoundingClientRect();
                        var offsets = {
-                               top: Math.round(rect.bottom) + document.body.scrollTop,
+                               top: Math.round(rect.bottom) + window.scrollY,
                                left: Math.round(rect.left) + document.body.scrollLeft
                        };
                        
                        if (this._lineHeight === null) {
-                               this._lineHeight = Math.round(rect.bottom - rect.top - document.body.scrollTop);
+                               this._lineHeight = Math.round(rect.bottom - rect.top - window.scrollY);
                        }
                        
                        // restore caret position
@@ -301,7 +301,7 @@ define(['Ajax', 'Environment', 'EventHandler', 'Ui/Alignment'], function(Ajax, E
                                
                                this._selectItem(0);
                                
-                               if (offset.top + this._dropdownMenu.offsetHeight + 10 > window.innerHeight + document.body.scrollTop) {
+                               if (offset.top + this._dropdownMenu.offsetHeight + 10 > window.innerHeight + window.scrollY) {
                                        this._dropdownMenu.classList.add('dropdownArrowBottom');
                                        
                                        this._dropdownMenu.style.setProperty('top', offset.top - this._dropdownMenu.offsetHeight - 2 * this._lineHeight + 7 + 'px', '');
index 1c7db1bdf7e1afe2f881914db8726cf0d2e38d31..e5ecf762d73b14f832aae4ec003da06759b07586 100644 (file)
@@ -66,7 +66,7 @@ define(['EventHandler', 'Language', 'Dom/Util', 'Ui/Dialog'], function(EventHand
                        if (typeof event === 'object') {
                                // check if click occured within the ::before pseudo element
                                var rect = DomUtil.offset(element);
-                               if ((event.clientY + document.body.scrollTop) > (rect.top + _quotePaddingTop + _titleHeight)) {
+                               if ((event.clientY + window.scrollY) > (rect.top + _quotePaddingTop + _titleHeight)) {
                                        return;
                                }