Permalink
Browse files

Popup: fix for $( document ).height() bug in core 1.7.2.

  • Loading branch information...
1 parent aca3959 commit 7268df3b73290667af7f60afd64b3d58c288731d @jaspermdegroot jaspermdegroot committed Jul 27, 2012
Showing with 7 additions and 1 deletion.
  1. +7 −1 js/widgets/popup.js
View
@@ -345,9 +345,15 @@ define( [ "jquery",
// Make sure the top of the menu is visible
ret.y = Math.max( 0, ret.y );
+
// If the height of the menu is smaller than the height of the document
// align the bottom with the bottom of the document
- ret.y -= Math.min( ret.y, Math.max( 0, ret.y + menuSize.cy - $( document ).height() ) );
+
+ // fix for $( document ).height() bug in core 1.7.2.
+ var docEl = document.documentElement, docBody = document.body,
+ docHeight = Math.max( docEl.clientHeight, docBody.scrollHeight, docBody.offsetHeight, docEl.scrollHeight, docEl.offsetHeight );
+
+ ret.y -= Math.min( ret.y, Math.max( 0, ret.y + menuSize.cy - docHeight ) );
return { left: ret.x, top: ret.y };
},

0 comments on commit 7268df3

Please sign in to comment.