Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /html/semantics/embedded-content/media-elements/interfaces/TextTrackCue/onexit.html - WPT Dashboard Interop Dashboard
<!doctype html>
<title>TextTrackCue.onexit</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<div id=log></div>
<script>
setup(function(){
window.c1 = new VTTCue(0, 1, 'text1');
window.ev = new Event('exit');
window.ran = false;
window.cb = function() { ran = true; };
});
test(function(){
assert_equals(c1.onexit, null, 'initial value');
c1.onexit = undefined;
assert_equals(c1.onexit, null, 'assigning undefined');
c1.onexit = cb;
assert_equals(c1.onexit, cb, 'assigning onexit');
c1.dispatchEvent(ev);
assert_true(ran, 'dispatching event');
c1.onexit = null;
assert_equals(c1.onexit, null, 'assigning null');
ran = false;
c1.dispatchEvent(ev);
assert_false(ran, 'dispatching event after nulling onexit');
});
test(function(){
c1.addEventListener('exit', cb, false);
c1.dispatchEvent(ev);
assert_true(ran);
c1.removeEventListener('exit', cb, false);
ran = false;
c1.dispatchEvent(ev);
assert_false(ran);
}, 'TextTrackCue.addEventListener/removeEventListener');
</script>