Some more fixes for IE and Edge
authorAlexander Ebert <ebert@woltlab.com>
Thu, 28 Jul 2016 18:59:12 +0000 (20:59 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Thu, 28 Jul 2016 18:59:12 +0000 (20:59 +0200)
Obviously Safari and Edge are equally garbage now, yay!

wcfsetup/install/files/js/WoltLab/WCF/Dom/Util.js

index 3427d48026793dc74326b016ed47c1272773a5b4..ef64f2bb4bbcb64be9ac4f872567f79b1097eb40 100644 (file)
@@ -154,8 +154,8 @@ define(['Environment', 'StringUtil'], function(Environment, StringUtil) {
                        var rect = el.getBoundingClientRect();
                        
                        return {
-                               top: rect.top + window.pageYOffset,
-                               left: rect.left + window.pageXOffset
+                               top: Math.round(rect.top + (window.scrollY || window.pageYOffset)),
+                               left: Math.round(rect.left + (window.scrollX || window.pageXOffset))
                        };
                },
                
@@ -198,7 +198,7 @@ define(['Environment', 'StringUtil'], function(Environment, StringUtil) {
                setStyles: function(el, styles) {
                        var important = false;
                        for (var property in styles) {
-                               if (objOwns(styles, property)) {
+                               if (styles.hasOwnProperty(property)) {
                                        if (/ !important$/.test(styles[property])) {
                                                important = true;
                                                
@@ -208,10 +208,10 @@ define(['Environment', 'StringUtil'], function(Environment, StringUtil) {
                                                important = false;
                                        }
                                        
-                                       // for a set style property with priority = important, Safari is not able to
-                                       // overwrite it with a property != important; removing the property first
-                                       // solves the issue
-                                       if (Environment.browser() === 'safari' && el.style.getPropertyPriority(property) === 'important' && !important) {
+                                       // for a set style property with priority = important, some browsers are
+                                       // not able to overwrite it with a property != important; removing the
+                                       // property first solves this issue
+                                       if (el.style.getPropertyPriority(property) === 'important' && !important) {
                                                el.style.removeProperty(property);
                                        }