Permalink
Browse files

fix #969 SynEvent used pageYOffset and pageXOffset on all version of IE

These properties are not supported on IE <= 8 (http://www.quirksmode.org/dom/w3c_cssom.html#windowview),
and returned undefined.

Now a fallback on scrollTop and scrollLeft has been done if
these properties doesn't exist.

Close #664, close #635, close #663
  • Loading branch information...
1 parent 19936ea commit 4e6455d93840688712e8fd08085ecd1ccc4de68c @fbasso committed Feb 7, 2014
Showing with 15 additions and 10 deletions.
  1. +13 −8 src/aria/jsunit/TemplateTestCase.js
  2. +2 −2 src/aria/utils/SynEvents.js
@@ -96,10 +96,7 @@ Aria.classDefinition({
$destructor : function () {
// Free also some memory cleaning the environment
this.__cleanEnv(true);
- if (this.testDiv) {
- this.testDiv.parentNode.removeChild(this.testDiv);
- this.testDiv = null;
- }
+ this.__removeTestDiv();
if (this.testIframe) {
this.testIframe.parentNode.removeChild(this.testIframe);
this.testIframe = null;
@@ -369,10 +366,7 @@ Aria.classDefinition({
this._disposeTestTemplate();
try {
- if (this.testDiv) {
- // null for iframe tests with errors
- this.testDiv.style.display = "none";
- }
+ this.__removeTestDiv();
if (this.testIframe) {
this.testIframe.style.display = "none";
}
@@ -923,6 +917,17 @@ Aria.classDefinition({
// Template tests are always asynchronous, but we need to call notifyTemplateTestEnd
this.$logError(this.EXCEPTION_IN_METHOD, methodName, ex);
this.notifyTemplateTestEnd();
+ },
+
+ /**
+ * Remove the testDiv dom element
+ * @private
+ */
+ __removeTestDiv : function() {
+ if (this.testDiv) {
+ this.testDiv.parentNode.removeChild(this.testDiv);
+ this.testDiv = null;
+ }
}
}
});
@@ -2478,8 +2478,8 @@
box = el.getBoundingClientRect();
}
var o = {
- top: box.top + Aria.$window.pageYOffset - docElem.clientTop,
- left: box.left + Aria.$window.pageXOffset - docElem.clientLeft
+ top: box.top + (Aria.$window.pageYOffset || Aria.$window.document.body.scrollTop) - docElem.clientTop,
+ left: box.left + (Aria.$window.pageXOffset || Aria.$window.document.body.scrollLeft) - docElem.clientLeft
};
return {
pageX: o.left + (el.offsetWidth / 2),

0 comments on commit 4e6455d

Please sign in to comment.