aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/library_browser.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/library_browser.js b/src/library_browser.js
index f3363e51..bf8444bd 100644
--- a/src/library_browser.js
+++ b/src/library_browser.js
@@ -478,8 +478,17 @@ mergeInto(LibraryManager.library, {
// in the coordinates.
var rect = Module["canvas"].getBoundingClientRect();
var x, y;
+
+ //Neither .scrollX or .pageXOffset are defined in a spec, but
+ //we prefer .scrollX because it is currently in a spec draft.
+ //(see: http://www.w3.org/TR/2013/WD-cssom-view-20131217/)
var scrollX = ((window.scrollX !== undefined) ? window.scrollX : window.pageXOffset);
var scrollY = ((window.scrollY !== undefined) ? window.scrollY : window.pageYOffset);
+ #if ASSERTIONS
+ //If this assert lands, it's likely because the browser doesn't support scrollX or pageXOffset
+ //and we have no viable fallback.
+ assert((scrollX !== undefined) && (scrollY !== undefined), 'Unable to retrieve scroll position, mouse positions likely broken.');
+ #endif
if (event.type == 'touchstart' ||
event.type == 'touchend' ||
event.type == 'touchmove') {