element.onended = handlerFunction; var handlerFunction = element.onended;
handlerFunction should be either
See the DOM event handlers page for information on working with
ended event is fired when playback has stopped because the end of the media was reached.
ended event documentation for more information about the event.
|HTML Living Standard
The definition of 'onended' in that specification.