2 <script src=
"../../resources/testharness.js"></script>
3 <script src=
"../../resources/testharnessreport.js"></script>
6 const svgNs
= 'http://www.w3.org/2000/svg';
8 function makeImage(test
) {
9 var image
= document
.createElementNS(svgNs
, 'image');
10 image
.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', 'resources/red-checker.png');
11 image
.setAttribute('width', 10);
12 image
.setAttribute('height', 10);
13 image
.onload
= test
.step_func(function() {
15 setTimeout(function() { test
.done(); }, 0);
20 function makeSvg(test
) {
21 var svgRoot
= document
.createElementNS(svgNs
, 'svg');
22 svgRoot
.onload
= test
.unreached_func("SVG 'load' should not be fired after document 'load'");
26 function makeSvgWithImage(test
) {
27 var svgRoot
= makeSvg(test
);
28 svgRoot
.appendChild(makeImage(test
));
32 var t0
= async_test("No 'load' event fired after document load for outer SVG root.");
33 var t1
= async_test("No 'load' event fired after document load for outer SVG root w/ image.");
34 var t2
= async_test("No 'load' event fired after document load for inner SVG root.");
35 var t3
= async_test("No 'load' event fired after document load for inner SVG root w/ image.");
37 window
.onload = function() {
38 var parsedSvg
= document
.querySelector('svg');
40 t0
.step(function() { document
.body
.appendChild(makeSvg(t0
)); });
41 t1
.step(function() { document
.body
.appendChild(makeSvgWithImage(t1
)); });
43 t2
.step(function() { parsedSvg
.appendChild(makeSvg(t2
)); });
44 t3
.step(function() { parsedSvg
.appendChild(makeSvgWithImage(t3
)); });
46 setTimeout(function() {