<!DOCTYPE html>
<html>
<head>
<title>This tests that svg text selection rect is properly sized and positioned.</title>
<style>
  body {
    margin: 0px;
    font-size: 16px;
  }
  ::selection {
    background: rgba(255, 0, 0, 0.9);
  }
  text { 
    fill: transparent; 
  }
</style>
</head>
<body>
<svg id=container><text x="20" y="20">foobar test</text></svg>
<script>
  var range = document.createRange(); 
  range.selectNode(document.getElementById("container")); 
  window.getSelection().addRange(range);
</script>
</body>
</html>
