<html>
<head>
<style>
@page {
  size: 500px 500px;
}
svg {
  border: 2px solid red;
}
</style>
</head>
<body style="padding: 5px;">

<!-- The circles should be the same size in the rendered document, showing the script has not run. -->
<svg viewBox="0 0 300 100" xmlns="http://www.w3.org/2000/svg" stroke="red" fill="grey"
     onload="document.getElementById('c1').setAttribute('r', 50);" >
     
  <circle id="c1" cx="50" cy="50" r="5" />
  
  <script>
     document.getElementById('c1').setAttribute('r', 20);