<!DOCTYPE html>
<p>Test for failing EventDispatchForbiddenScope assert when moving a
video with text track between documents.</p>
<video></video>
<iframe></iframe>
<script>
if (window.testRunner)
  testRunner.dumpAsText();

var video = document.querySelector("video");
var track = document.createElement("track");

// Note: The order of setting the text track mode and appending the
// track element is important, in terms of implementation and spec:
// https://www.w3.org/Bugs/Public/show_bug.cgi?id=28973
track.track.mode = "showing";
video.appendChild(track);

// Move the video element to another document.
var iframe = document.querySelector("iframe");
iframe.contentDocument.body.appendChild(video);
</script>
