OLD | NEW |
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 * Alias for document.getElementById. | 8 * Alias for document.getElementById. |
9 * @param {string} id The ID of the element to find. | 9 * @param {string} id The ID of the element to find. |
10 * @return {HTMLElement} The found element or null if not found. | 10 * @return {HTMLElement} The found element or null if not found. |
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 * webkitTransitionEnd to happen. | 376 * webkitTransitionEnd to happen. |
377 */ | 377 */ |
378 function ensureTransitionEndEvent(el, timeOut) { | 378 function ensureTransitionEndEvent(el, timeOut) { |
379 var fired = false; | 379 var fired = false; |
380 el.addEventListener('webkitTransitionEnd', function f(e) { | 380 el.addEventListener('webkitTransitionEnd', function f(e) { |
381 el.removeEventListener('webkitTransitionEnd', f); | 381 el.removeEventListener('webkitTransitionEnd', f); |
382 fired = true; | 382 fired = true; |
383 }); | 383 }); |
384 window.setTimeout(function() { | 384 window.setTimeout(function() { |
385 if (!fired) | 385 if (!fired) |
386 cr.dispatchSimpleEvent(el, 'webkitTransitionEnd'); | 386 cr.dispatchSimpleEvent(el, 'webkitTransitionEnd', true); |
387 }, timeOut); | 387 }, timeOut); |
388 } | 388 } |
389 | 389 |
390 /** | 390 /** |
391 * Alias for document.scrollTop getter. | 391 * Alias for document.scrollTop getter. |
392 * @param {!HTMLDocument} doc The document node where information will be | 392 * @param {!HTMLDocument} doc The document node where information will be |
393 * queried from. | 393 * queried from. |
394 * @return {number} The Y document scroll offset. | 394 * @return {number} The Y document scroll offset. |
395 */ | 395 */ |
396 function scrollTopForDocument(doc) { | 396 function scrollTopForDocument(doc) { |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 * @param {number} maxLength The maximum length allowed for the string. | 447 * @param {number} maxLength The maximum length allowed for the string. |
448 * @return {string} The original string if its length does not exceed | 448 * @return {string} The original string if its length does not exceed |
449 * |maxLength|. Otherwise the first |maxLength| - 1 characters with '...' | 449 * |maxLength|. Otherwise the first |maxLength| - 1 characters with '...' |
450 * appended. | 450 * appended. |
451 */ | 451 */ |
452 function elide(original, maxLength) { | 452 function elide(original, maxLength) { |
453 if (original.length <= maxLength) | 453 if (original.length <= maxLength) |
454 return original; | 454 return original; |
455 return original.substring(0, maxLength - 1) + '\u2026'; | 455 return original.substring(0, maxLength - 1) + '\u2026'; |
456 } | 456 } |
OLD | NEW |