OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <title>Test that cues are being matched properly by the lang attribute and :lang
() pseudo class.</title> | 2 <title>Test that cues are being matched properly by the lang attribute and :lang
() pseudo class.</title> |
3 <script src="../media-file.js"></script> | 3 <script src="../media-file.js"></script> |
4 <script src="../media-controls.js"></script> | 4 <script src="../media-controls.js"></script> |
5 <script src="../../resources/testharness.js"></script> | 5 <script src="../../resources/testharness.js"></script> |
6 <script src="../../resources/testharnessreport.js"></script> | 6 <script src="../../resources/testharnessreport.js"></script> |
7 <style> | 7 <style> |
8 ::cue(:lang(ru)) { color: lime; } | 8 ::cue(:lang(ru)) { color: lime; } |
9 ::cue(lang[lang="en"]) { color: purple; } | 9 ::cue(lang[lang="en"]) { color: purple; } |
10 ::cue(c[lang="ru"]) { color: red; } /* Shouldn't work, no attribute 'lang' for '
c'. */ | 10 ::cue(c[lang="ru"]) { color: red; } /* Shouldn't work, no attribute 'lang' for '
c'. */ |
11 </style> | 11 </style> |
12 <video></video> | 12 <video></video> |
13 <script> | 13 <script> |
14 async_test(function(t) { | 14 async_test(function(t) { |
15 var video = document.querySelector('video'); | 15 var video = document.querySelector('video'); |
16 video.src = findMediaFile('video', '../content/test'); | 16 video.src = findMediaFile('video', '../content/test'); |
17 | 17 |
18 var track = document.createElement('track'); | 18 var track = document.createElement('track'); |
19 track.src = 'captions-webvtt/styling-lang.vtt'; | 19 track.src = 'captions-webvtt/styling-lang.vtt'; |
20 track.kind = 'captions'; | 20 track.kind = 'captions'; |
21 track.default = true; | 21 track.default = true; |
22 video.appendChild(track); | 22 video.appendChild(track); |
23 | 23 |
24 video.onseeked = t.step_func_done(function() { | 24 video.onseeked = t.step_func_done(function() { |
25 var cueNode = textTrackDisplayElement(video, 'cue').firstElementChild.fi
rstElementChild; | 25 var cueNode = textTrackCueElementByIndex(video, 0).firstChild.firstEleme
ntChild.firstElementChild; |
26 assert_equals(getComputedStyle(cueNode).color, 'rgb(128, 0, 128)'); | 26 assert_equals(getComputedStyle(cueNode).color, 'rgb(128, 0, 128)'); |
27 cueNode = cueNode.firstElementChild.firstElementChild; | 27 cueNode = cueNode.firstElementChild.firstElementChild; |
28 assert_equals(getComputedStyle(cueNode).color, 'rgb(0, 255, 0)'); | 28 assert_equals(getComputedStyle(cueNode).color, 'rgb(0, 255, 0)'); |
29 cueNode = cueNode.firstElementChild.firstElementChild; | 29 cueNode = cueNode.firstElementChild.firstElementChild; |
30 assert_equals(getComputedStyle(cueNode).color, 'rgb(128, 0, 128)'); | 30 assert_equals(getComputedStyle(cueNode).color, 'rgb(128, 0, 128)'); |
31 }); | 31 }); |
32 | 32 |
33 video.currentTime = 0.1; | 33 video.currentTime = 0.1; |
34 }); | 34 }); |
35 </script> | 35 </script> |
OLD | NEW |