blob: d33de9c68de14e3d26da187e31073fc959975ce7 [file] [log] [blame]
<!DOCTYPE html>
<html lang="en">
<title>Test of dynamic stylesheet loading</title>
<link rel="stylesheet" href="resources/dynamic-stylesheet-insertion-main.css">
<script src="resources/animation-test-helpers.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
const expectedValues = [
// [time, element-id, property, expected-value, tolerance]
[0.3, "splash", "webkitTransform.5", 100, 0.1],
var controller = {};
controller.init = function () {
// put a listener on the initial splash animation
this.splash = document.getElementById('splash');
this.splash.addEventListener('webkitAnimationStart', this, false);
this.splash.addEventListener('webkitAnimationEnd', this, false);
runAnimationTest(expectedValues, undefined, undefined, true);
controller.handleEvent = function (event) {
if (event.type == 'webkitAnimationStart') {
// pre-load the stylesheet
var link = document.createElement('link');
link.rel = 'stylesheet';
link.href = 'resources/dynamic-stylesheet-insertion-inserted.css';
window.addEventListener('DOMContentLoaded', function () {
}, false);
This test performs an animation and then dynamically loads a new stylesheet (which is empty). It should start
animating after a 100ms delay and then stop halfway through the animation at which point we see if it is at the
correct position. The loading of the stylesheet should not prevent the animation from running.
<div id="splash"></div>
<div id="result">