server/camlistored: cross-browser scrollTop getter

It looks like our vendored version of goog.dom.getDocumentScrollElement().scrollTop
does not work anymore for all browsers, as infinite scrolling is broken
for some.

This change is a work-around while we're working on a cleaner fix, like
seeing if an updated closure lib works correctly.

Fixes #961

Change-Id: I713529ff796f50ff7cf9234befbf6abbfb75e3cb
This commit is contained in:
mpl 2017-10-02 20:39:29 +02:00
parent 683fa350f7
commit 5f0a625e76
1 changed files with 5 additions and 1 deletions

View File

@ -100,7 +100,11 @@ limitations under the License.
scrolling: {
target: window,
// Note that calling get() can cause layout, so should be used only once per scroll event.
get: function() { return goog.dom.getDocumentScrollElement().scrollTop; },
get: function() {
// TODO(mpl): see if a recent version of getDocumentScrollElement does things
// correctly, and if yes, restore the getDocumentScrollElement().scrollTop call.
return Math.max(document.body.scrollTop,document.documentElement.scrollTop);
},
set: function(val) { goog.dom.getDocumentScrollElement().scrollTop = val; },
},
serverConnection: new cam.ServerConnection(CAMLISTORE_CONFIG),