4 <script src=
"../../media/media-file.js"></script>
5 <script src=
"../../media/video-test.js"></script>
6 <script type=
"text/javascript">
8 var standaloneMediaDocument
;
9 var skipOnFirstEmptyLoad
= 0;
11 function frameLoaded()
13 if (++skipOnFirstEmptyLoad
== 1)
16 standaloneMediaDocument
= document
.getElementById("videoframe").contentDocument
;
17 videoElement
= standaloneMediaDocument
.querySelector("video");
19 videoElement
.addEventListener('click',function(){
20 consoleWrite("*** Video element clicked.");
24 testFocusbyMouseClick();
31 consoleWrite("<br>*** Should not focus video element by calling focus() method.");
33 testExpected("standaloneMediaDocument.activeElement", videoElement
, "!=");
36 function testFocusbyMouseClick()
38 // Simulate click event to try focus video element.
39 consoleWrite("<br>*** Should not focus video element by mouse click.");
40 var click
= document
.createEvent("MouseEvents");
41 click
.initMouseEvent("click", true, true, window
, 1, 0, 0, 0, 0, false, false, false, false, 0, document
);
42 videoElement
.dispatchEvent(click
);
43 testExpected("standaloneMediaDocument.activeElement", videoElement
, "!=");
49 This tests that media element in a standalone media document cannot be focused directly using focus() method or by mouse click.
51 <iframe id=
"videoframe" width=
380 height=
330 onload=
"frameLoaded()"></iframe>
52 <script type=
"text/javascript">
53 document
.getElementById("videoframe").src
= "../../media/" + findMediaFile("video", "content/test");