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/track/track-element/track-cue-negative-duration.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<title>Enter, Exit events for a cue with negative duration</title>
<script src="/common/media.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<video>
<script>
async_test(function(t) {
var video = document.querySelector("video");
var track = video.addTextTrack("subtitles");
// Add a cue with negative duration.
var cue = new VTTCue(1, -10, "Sausage?");
track.addCue(cue);
assert_equals(track.cues.length, 1);
// Verify that enter and exit events are fired.
var enterEvent = false;
cue.onenter = t.step_func(function() {
enterEvent = true;
});
cue.onexit = t.step_func_done(function() {
assert_true(enterEvent);
});
video.src = getVideoURI("/media/test");
video.play();
});
</script>
</video>