1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
2 "http://www.w3.org/TR/html4/loose.dtd">
6 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
7 <meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
8 <title>Test of dynamic stylesheet loading</title>
9 <link rel="stylesheet" href="resources/dynamic-stylesheet-insertion-main.css">
10 <script src="resources/animation-test-helpers.js" type="text/javascript" charset="utf-8"></script>
11 <script type="text/javascript" charset="utf-8">
13 const expectedValues = [
14 // [animation-name, time, element-id, property, expected-value, tolerance]
15 ["splashdown", 0.3, "splash", "webkitTransform.5", 100, 0.1],
20 controller.init = function () {
21 // put a listener on the initial splash animation
22 this.splash = document.getElementById('splash');
23 this.splash.addEventListener('webkitAnimationStart', this, false);
24 this.splash.addEventListener('webkitAnimationEnd', this, false);
26 runAnimationTest(expectedValues, undefined, undefined, true);
29 controller.handleEvent = function (event) {
30 if (event.type == 'webkitAnimationStart') {
31 // pre-load the stylesheet
32 var link = document.createElement('link');
33 link.rel = 'stylesheet';
34 link.href = 'resources/dynamic-stylesheet-insertion-inserted.css';
35 document.head.appendChild(link);
39 window.addEventListener('DOMContentLoaded', function () {
46 This test performs an animation and then dynamically loads a new stylesheet (which is empty). It should start
47 animating after a 100ms delay and then stop halfway through the animation at which point we see if it is at the
48 correct position. The loading of the stylesheet should not prevent the animation from running.
49 <div id="splash"></div>