| <!DOCTYPE html> |
| <html> |
| <head> |
| <script src="../../resources/js-test-pre.js"></script> |
| </head> |
| <body> |
| <script> |
| var video = document.createElement('video'); |
| |
| var tracka = document.createElement('track'); |
| video.appendChild(tracka); |
| var trackb = document.createElement('track'); |
| video.appendChild(trackb); |
| |
| debug("Adding tracks outside the DOM tree:"); |
| shouldBe("video.textTracks.length", "2"); |
| shouldBe("video.textTracks[0]", "tracka.track"); |
| shouldBe("video.textTracks[1]", "trackb.track"); |
| |
| debug("Inserting the parent video element into the document."); |
| document.body.appendChild(video); |
| shouldBe("video.textTracks.length", "2"); |
| shouldBe("video.textTracks[0]", "tracka.track"); |
| shouldBe("video.textTracks[1]", "trackb.track"); |
| |
| debug("Inserting and removing another track in the document."); |
| var trackc = document.createElement('track'); |
| video.appendChild(trackc); |
| shouldBe("video.textTracks.length", "3"); |
| shouldBe("video.textTracks[2]", "trackc.track"); |
| |
| trackb.parentNode.removeChild(trackb); |
| shouldBe("video.textTracks.length", "2"); |
| shouldBe("video.textTracks[0]", "tracka.track"); |
| shouldBe("video.textTracks[1]", "trackc.track"); |
| |
| debug("Removing the video from the document."); |
| document.body.removeChild(video); |
| shouldBe("video.textTracks.length", "2"); |
| shouldBe("video.textTracks[0]", "tracka.track"); |
| shouldBe("video.textTracks[1]", "trackc.track"); |
| |
| tracka.parentNode.removeChild(tracka); |
| shouldBe("video.textTracks.length", "1"); |
| shouldBe("video.textTracks[0]", "trackc.track"); |
| |
| </script> |
| <script src="../../resources/js-test-post.js"></script> |
| </body> |
| </html> |