var _recordedEvents = new Array(); // Number of events we're supposed to receive. var _expectedEventCount = 0; // Function invoked when we've received _expectedEventCount events. var _endFunction; // Have we processed the events? This is used to make sure we process the // events only once. var _processedEvents = false; /* Call this function to record manually transition end events: Function parameters: event [required]: the event passed with "webkitTransitionEnd" or "transitionend" */ function recordTransitionEndEvent(event) { if (event.type != "webkitTransitionEnd" && event.type != "transitionend" ) throw("Invalid transition end event!"); _recordedEvents.push([ event.propertyName, event.target.id, Math.round(event.elapsedTime * 1000) / 1000 // round to ms to avoid floating point imprecision ]); if (_recordedEvents.length == _expectedEventCount) _endFunction(); } /* This is the helper function to run transition end event tests: Test page requirements: - The body must contain an empty div with id "result" - The body must contain a div with with id "container" - Call this function directly from the