Bug 1415010 - Bind onanimationxx handlers before creating EventWatcher. r=birtles

So that we can surely receive these animation events in the handler before
the EventWatcher receives the events.

MozReview-Commit-ID: 9jVJ3TgwYeq

--HG--
extra : rebase_source : 470b63b35c3a52f48ddd08d4b529c6b1eb957cb2
This commit is contained in:
Hiroyuki Ikezoe 2017-11-07 10:30:07 +09:00
parent fdf597eae9
commit d96dadbd8a

View File

@ -38,9 +38,6 @@ events (${expectedEvents.map(event => event.type).join(', ')})`);
function setupAnimation(t, animationStyle, receiveEvents) {
const div = addDiv(t, { style: "animation: " + animationStyle });
const watcher = new EventWatcher(t, div, [ 'animationstart',
'animationiteration',
'animationend' ]);
['start', 'iteration', 'end'].forEach(name => {
div['onanimation' + name] = evt => {
@ -50,6 +47,10 @@ function setupAnimation(t, animationStyle, receiveEvents) {
};
});
const watcher = new EventWatcher(t, div, [ 'animationstart',
'animationiteration',
'animationend' ]);
const animation = div.getAnimations()[0];
return [animation, watcher, div];