object.addEventListener("load", function (){ здесь обработчик })
<object data="file.svg" type="image/svg+xml" id="for_svg" width="400px" height="300px"></object>
<script>
document.querySelector("#for_svg").addEventListener("load", function (){
let html = document.querySelector("#for_svg").contentDocument;
let rects = html.querySelectorAll("rect");
rects[0].style.fill = "#222";
rects[1].style.fill = "#fff";
rects[2].style.fill = "#fff";
rects[3].style.fill = "#999";
rects[4].style.fill = "#999";
})
</script>
<svg viewBox="0 0 460 300" xmlns="http://www.w3.org/2000/svg" width="460" height="300">
<rect width="460px" height="300px" x="0" y="0" />
<g>
<rect width="100px" height="80px" x="0" y="220" />
<rect width="100px" height="120px" x="120" y="180" />
<rect width="100px" height="200px" x="240" y="100" />
<rect width="100px" height="300px" x="360" y="0" />
</g>
</svg>
<svg height="200" viewBox="0 0 400 400" xmlns="http://www.w3.org/2000/svg">
<path d="M 15.498 487.577 L 15.498 431.037 L 62.884 396.913 L 94.033 351.883 L 158.319 309.973 L 189.252 236.175 L 280.039 205.522 L 302.034 124.519 L 320.749 62.004 L 384.937 13.925 L 445.421 30.396 L 469.462 54.445 L 469.462 488.53" stroke="red" stroke-width="4" fill="red" fill-opacity="0" stroke-dasharray="0 1637">
<animate attributeName="stroke-dasharray"
dur="2s"
begin="0s"
repeatCount="1"
values="0 1637; 1637 1637"
id="path"
fill="freeze"/>
<animate attributeName="stroke"
dur="1s"
begin="path.end"
repeatCount="1"
values="red; blue"
fill="freeze"/>
<animate attributeName="fill-opacity"
dur="1s"
begin="path.end"
repeatCount="1"
values="0; 1"
fill="freeze"/>
</path>
</svg>
<svg id="svg" viewBox="0 0 1000 1000">
<defs>
<linearGradient id="grad" x1="7%" y1="0%" x2="93%" y2="100%" >
<stop offset="0%" style="stop-color:rgb(255,29,139);stop-opacity:1" />
<stop offset="100%" style="stop-color:rgb(255,255,255);stop-opacity:1" />
</linearGradient>
<pattern id="bg" x="0" y="0" width="20" height="20" viewBox ='0 0 80 80' patternUnits="userSpaceOnUse">
<circle fill="0x0" cx="3" cy="3" r="2.5"></circle>
</pattern>
<pattern id="both" width="100%" height="100%">
<rect width="100%" height="100%" fill="url(#grad)"/>
<rect width="100%" height="100%" fill="url(#bg)"/>
</pattern>
</defs>
<g>
<path id="path3" d="M0,0 1000,0 1000,1000 0,1000z" fill="url(#both)"></path>
</g>
</svg>