Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1139)

Side by Side Diff: ui/webui/resources/js/util.js

Issue 68723003: Make chrome/ be documentElement/body agnostic with regards to scrollTop/Left (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@issue_305800
Patch Set: Make chrome/ be documentElement/body agnostic with regards to scrollTop/Left Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 <include src="assert.js"> 5 <include src="assert.js">
6 6
7 /** 7 /**
8 * The global object. 8 * The global object.
9 * @type {!Object} 9 * @type {!Object}
10 * @const 10 * @const
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 var fired = false; 314 var fired = false;
315 el.addEventListener('webkitTransitionEnd', function f(e) { 315 el.addEventListener('webkitTransitionEnd', function f(e) {
316 el.removeEventListener('webkitTransitionEnd', f); 316 el.removeEventListener('webkitTransitionEnd', f);
317 fired = true; 317 fired = true;
318 }); 318 });
319 window.setTimeout(function() { 319 window.setTimeout(function() {
320 if (!fired) 320 if (!fired)
321 cr.dispatchSimpleEvent(el, 'webkitTransitionEnd'); 321 cr.dispatchSimpleEvent(el, 'webkitTransitionEnd');
322 }, timeOut); 322 }, timeOut);
323 } 323 }
324
325 /**
326 * Alias for document.scrollTop getter.
327 * @param {!HTMLDocument} doc The document node where information will be querie d from.
Dan Beam 2013/11/11 23:46:46 80 col wrap
328 * @return {number} The Y document scroll offset.
329 */
330 function scrollTopForDocument(doc) {
331 return doc.documentElement.scrollTop || doc.body.scrollTop;
332 }
333
334 /**
335 * Alias for document.scrollTop setter.
336 * @param {!HTMLDocument} doc The document node where information will be querie d from.
337 * @param {number} value The target Y scroll offset.
338 */
339 function setScrollTopForDocument(doc, value) {
340 doc.documentElement.scrollTop = doc.body.scrollTop = value;
341 }
342
343 /**
344 * Alias for document.scrollLeft getter.
345 * @param {!HTMLDocument} doc The document node where information will be querie d from.
346 * @return {number} The X document scroll offset.
347 */
348 function scrollLeftForDocument(doc) {
349 return doc.documentElement.scrollLeft || doc.body.scrollLeft;
350 }
351
352 /**
353 * Alias for document.scrollLeft setter.
354 * @param {!HTMLDocument} doc The document node where information will be querie d from.
355 * @param {number} value The target X scroll offset.
356 */
357 function setScrollLeftForDocument(doc, value) {
358 doc.documentElement.scrollLeft = doc.body.scrollLeft = value;
359 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698