OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <script> |
| 3 if (window.testRunner) { |
| 4 testRunner.dumpAsText(); |
| 5 testRunner.waitUntilDone(); |
| 6 window.onload = function() { |
| 7 testRunner.displayAsyncThen(function() { |
| 8 mutateTree(); |
| 9 testRunner.displayAsyncThen(function() { |
| 10 testRunner.notifyDone(); |
| 11 }); |
| 12 }); |
| 13 }; |
| 14 } else { |
| 15 window.onload = function() { setTimeout(mutateTree, 100); }; |
| 16 } |
| 17 const svgNs = 'http://www.w3.org/2000/svg'; |
| 18 function buildPattern(patternId, refId) { |
| 19 var pattern = document.createElementNS(svgNs, 'pattern'); |
| 20 var rect = pattern.appendChild(document.createElementNS(svgNs, 'rect')); |
| 21 pattern.setAttribute('id', patternId); |
| 22 pattern.setAttribute('width', 1); |
| 23 pattern.setAttribute('height', 1); |
| 24 rect.setAttribute('width', 100); |
| 25 rect.setAttribute('height', 100); |
| 26 rect.setAttribute('fill', 'url(#' + refId + ')'); |
| 27 return pattern; |
| 28 } |
| 29 function mutateTree() { |
| 30 // Build a three-step pattern cycle in a detached |
| 31 // subtree and then insert it at load. |
| 32 var defs = document.createElementNS(svgNs, 'defs'); |
| 33 defs.appendChild(buildPattern('p3', 'p1')); |
| 34 defs.appendChild(buildPattern('p2', 'p3')); |
| 35 defs.appendChild(buildPattern('p1', 'p2')); |
| 36 document.querySelector('svg').appendChild(defs); |
| 37 } |
| 38 </script> |
| 39 <p>PASS if no crash (stack overflow).</p> |
| 40 <svg width="100" height="100"> |
| 41 <rect width="100" height="100" fill="url(#p1)"/> |
| 42 </svg> |
OLD | NEW |