<html> | |
<body> | |
<svg xmlns="http://www.w3.org/2000/svg" height="100%" width="100%"> | |
<!-- The FO should be visible and completely cover the red rect. --> | |
<rect id="rect" width="100" height="100" fill="red"/> | |
<g> | |
<foreignObject id="fo" width="100" height="100"> | |
<div style="background-color: green; width: 100px; height: 100px;"/> | |
</foreignObject> | |
</g> | |
</svg> | |
<script> | |
var pos = Math.round(window.innerWidth * 2 / 3); | |
document.getElementById('rect').setAttribute('x', pos); | |
document.getElementById('fo').setAttribute('x', pos); | |
</script> | |
</body> | |
</html> |