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/TextTrack/oncuechange.html - WPT Dashboard Interop Dashboard
<!doctype html>
<title>TextTrack.oncuechange</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<div id=log></div>
<script>
setup(function(){
window.video = document.createElement('video');
window.t1 = video.addTextTrack('subtitles');
window.ev = new Event('cuechange');
window.ran = false;
window.cb = function() { ran = true; };
});
test(function(){
assert_equals(t1.oncuechange, null);
t1.oncuechange = cb;
t1.dispatchEvent(ev);
assert_true(ran);
t1.oncuechange = null;
ran = false;
t1.dispatchEvent(ev);
assert_false(ran);
});
test(function(){
t1.addEventListener('cuechange', cb, false);
t1.dispatchEvent(ev);
assert_true(ran);
t1.removeEventListener('cuechange', cb, false);
ran = false;
t1.dispatchEvent(ev);
assert_false(ran);
}, 'TextTrack.addEventListener/removeEventListener');
</script>