summaryrefslogtreecommitdiffstats
path: root/LayoutTests/fast/dom/beforeload/pi-before-load.xhtml
blob: 58c19e1fee4f129041e102c5051a0915b59787b0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style>
.block {
  width: 100px;
  height: 100px;
  background-color: green;
}
</style>
<script src="resources/print.js"></script>
<script>
function test()
{
    if (window.layoutTestController)
        layoutTestController.dumpAsText();

    if (document.getElementById('block').offsetWidth == 100)
        print("PASS", "green");
    else
        print("FAIL", "red");
}
</script>
</head>
<body onload="test()">
<div id="block" class="block"></div>
<script>
function beforeLoadFunc()
{
    event.preventDefault();
}

document.addEventListener("beforeload", beforeLoadFunc, true);

var pi = document.createProcessingInstruction("xml-stylesheet", "type=\"text/css\" href=\"resources/fail.css\"");
document.insertBefore(pi, document.documentElement);
</script>
<hr/>
<div id="console"></div>
</body>
</html>