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

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: 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
« no previous file with comments | « chrome/browser/resources/uber/uber_utils.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
328 * queried from.
329 * @return {number} The Y document scroll offset.
330 */
331 function scrollTopForDocument(doc) {
332 return doc.documentElement.scrollTop || doc.body.scrollTop;
333 }
334
335 /**
336 * Alias for document.scrollTop setter.
337 * @param {!HTMLDocument} doc The document node where information will be
338 * queried from.
339 * @param {number} value The target Y scroll offset.
340 */
341 function setScrollTopForDocument(doc, value) {
342 doc.documentElement.scrollTop = doc.body.scrollTop = value;
343 }
344
345 /**
346 * Alias for document.scrollLeft getter.
347 * @param {!HTMLDocument} doc The document node where information will be
348 * queried from.
349 * @return {number} The X document scroll offset.
350 */
351 function scrollLeftForDocument(doc) {
352 return doc.documentElement.scrollLeft || doc.body.scrollLeft;
353 }
354
355 /**
356 * Alias for document.scrollLeft setter.
357 * @param {!HTMLDocument} doc The document node where information will be
358 * queried from.
359 * @param {number} value The target X scroll offset.
360 */
361 function setScrollLeftForDocument(doc, value) {
362 doc.documentElement.scrollLeft = doc.body.scrollLeft = value;
363 }
OLDNEW
« no previous file with comments | « chrome/browser/resources/uber/uber_utils.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698