Chromium Code Reviews| Index: ui/webui/resources/js/util.js |
| diff --git a/ui/webui/resources/js/util.js b/ui/webui/resources/js/util.js |
| index 2707dbcdd25f12ec3d996f72d60fc049849293c5..7244a6341845b4658a040226cd2deef5c253c778 100644 |
| --- a/ui/webui/resources/js/util.js |
| +++ b/ui/webui/resources/js/util.js |
| @@ -375,9 +375,18 @@ function createElementWithClassName(type, className) { |
| * a timer and emulate the event if it is not fired when the timer expires. |
| * @param {!HTMLElement} el The element to watch for webkitTransitionEnd. |
| * @param {number} timeOut The maximum wait time in milliseconds for the |
| - * webkitTransitionEnd to happen. |
| + * webkitTransitionEnd to happen. If not specified, it is fetched from |el| |
| + * using the transitionDuration style value. |
| */ |
| function ensureTransitionEndEvent(el, timeOut) { |
|
xiyuan
2016/03/18 15:37:48
nit: timeOut -> opt_timeOut and update comments (j
jdufault
2016/03/18 17:31:56
Done.
|
| + if (timeOut == null) { |
|
xiyuan
2016/03/18 15:37:48
"=== undefined" to test whether an optional arg is
jdufault
2016/03/18 17:31:56
Done.
|
| + var style = getComputedStyle(el); |
| + timeOut = parseFloat(style.transitionDuration) * 1000; |
| + |
| + // Give an additional 50ms buffer for the animation to complete. |
| + timeOut += 50; |
| + } |
| + |
| var fired = false; |
| el.addEventListener('webkitTransitionEnd', function f(e) { |
| el.removeEventListener('webkitTransitionEnd', f); |