Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / svg / custom / load-svgfragments-inserted-after-docload.html
blob80dc1d5b940254afbf2c06a0effd497795b88c3f
1 <!DOCTYPE html>
2 <script src="../../resources/testharness.js"></script>
3 <script src="../../resources/testharnessreport.js"></script>
4 <svg></svg>
5 <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() {
14 assert_true(true);
15 setTimeout(function() { test.done(); }, 0);
16 });
17 return image;
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'");
23 return svgRoot;
26 function makeSvgWithImage(test) {
27 var svgRoot = makeSvg(test);
28 svgRoot.appendChild(makeImage(test));
29 return svgRoot;
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() {
47 t0.done();
48 t2.done();
49 }, 0);
51 </script>