blob: b2a45b366c140f0aa878c41c2d148c3756ba2f21 [file] [log] [blame]
<!DOCTYPE html>
<title>Test that ::cue pseudo-element properties are applied to WebVTT node objects only.</title>
<script src="../media-file.js"></script>
<script src="../media-controls.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<style>
::cue { word-spacing: 100px; }
::cue(c) { padding-left: 10px; color: red; }
.cue {
display: inline;
background-color: green;
}
</style>
<video>
<track src="captions-webvtt/whitelist.vtt" kind="captions" default>
</video>
<div class="cue"></div>
<script>
async_test(function(t) {
var video = document.querySelector("video");
video.src = findMediaFile("video", "../content/test");
video.onseeked = t.step_func_done(function() {
var cueNode = textTrackCueElementByIndex(video, 0).firstChild.firstElementChild;
var cueStyle = getComputedStyle(cueNode);
assert_equals(cueStyle.color, "rgb(255, 0, 0)");
assert_equals(cueStyle.padding, "0px");
assert_equals(cueStyle.wordSpacing, "0px");
cueNode = cueNode.nextElementSibling;
cueStyle = getComputedStyle(cueNode);
assert_equals(cueStyle.color, "rgb(255, 0, 0)");
assert_equals(cueStyle.padding, "0px");
assert_equals(cueStyle.wordSpacing, "0px");
cueNode = cueNode.nextElementSibling;
cueStyle = getComputedStyle(cueNode);
assert_equals(cueStyle.color, "rgb(255, 0, 0)");
assert_equals(cueStyle.padding, "0px");
assert_equals(cueStyle.wordSpacing, "0px");
// Test that filtering doesn't apply to elements with class "cue" outside WebVTT scope.
cueNode = document.getElementsByClassName("cue")[0];
assert_equals(getComputedStyle(cueNode).display, "inline");
});
video.currentTime = 0.1;
});
</script>