Truly independent web browser
<!DOCTYPE html>
<script src="../../include.js"></script>
<svg width="200" height="100">
<rect id="rect" x="10" y="10" width="10" height="10" stroke="black" stroke-width="2" />
<circle id="circle" cx="60" cy="50" r="5" />
<path id="path" d="M 100 10 L 110 10 L 110 20 Z" />
<rect id="opacity" x="150" y="10" width="10" height="10" />
</svg>
<script>
test(() => {
const animations = [
rect.animate({ width: ["10px", "30px"], strokeWidth: ["2px", "6px"] }, { duration: 1000, fill: "both" }),
circle.animate({ r: ["5px", "25px"] }, { duration: 1000, fill: "both" }),
path.animate({ d: ['path("M 100 10 L 110 10 L 110 20 Z")', 'path("M 100 10 L 150 10 L 150 60 Z")'] }, { duration: 1000, fill: "both" }),
opacity.animate({ opacity: [1, 0] }, { duration: 1000, fill: "both" }),
];
const shapes = [rect, circle, path, opacity];
for (const animation of animations) {
animation.pause();
animation.currentTime = 0;
}
internals.updateStyle();
const widthsBefore = shapes.map(shape => shape.getBoundingClientRect().width);
for (const animation of animations)
animation.currentTime = 500;
internals.updateStyle();
const sampledWidths = shapes.map(shape => shape.getBoundingClientRect().width);
for (const [index, shape] of shapes.entries())
println(`${shape.id} sample changes geometry: ${sampledWidths[index] !== widthsBefore[index]}`);
println(`animated SVG layout stays consistent: ${internals.compareLayoutTreeWithFullRebuild().matches}`);
for (const [index, shape] of shapes.entries())
println(`${shape.id} geometry matches fresh layout: ${shape.getBoundingClientRect().width === sampledWidths[index]}`);
});
</script>