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>
<svg version="1.1" viewBox="0 0 60 60" xmlns="http://www.w3.org/2000/svg">
<path d="m54.002489 16.514931c-2.587961-4.5852-6.098365-8.2153072-10.532137-10.891144-4.434431-2.6759732-9.275509-4.0136182-14.526268-4.0136182-5.250494 0-10.093155 1.3380549-14.526267 4.0136182-4.434168 2.6757-7.944441 6.3059438-10.532402 10.891144-2.5875658 4.585061-3.8814146 9.591984-3.8814146 15.021041 0 6.521039 1.8398707 12.384921 5.5205361 17.593699 3.6802689 5.208642 8.4346329 8.812818 14.262299 10.81294 0.678401 0.130203 1.180604 0.03863 1.507135-0.272414 0.326663-0.311449 0.489797-0.70151 0.489797-1.168547 0-0.07793-0.0065-0.77903-0.01901-2.104119-0.01293-1.32509-0.01901-2.481079-0.01901-3.467423l-0.866745 0.155041c-0.552618 0.104682-1.249762 0.149037-2.091431 0.136481-0.841272-0.01214-1.714617-0.103315-2.618846-0.272825-0.904625-0.168007-1.746029-0.557659-2.524872-1.168136-0.778443-0.610477-1.331064-1.40957-1.657728-2.396051l-0.376817-0.896678c-0.251168-0.596966-0.646594-1.260123-1.186809-1.987018-0.540214-0.727579-1.0865-1.220818-1.639121-1.480541l-0.263839-0.195304c-0.175803-0.129793-0.338937-0.286336-0.489796-0.467992-0.150727-0.181655-0.2635742-0.363447-0.3389374-0.545511-0.0754947-0.182202-0.0129365-0.331649 0.1883424-0.448885 0.201277-0.117238 0.565028-0.174149 1.092836-0.174149l0.75337 0.116418c0.502467 0.104132 1.123984 0.415174 1.865344 0.935028 0.740963 0.519444 1.350074 1.194749 1.827465 2.025643 0.578093 1.065366 1.274579 1.877153 2.091434 2.435767 0.816195 0.558614 1.639121 0.837445 2.467987 0.837445 0.828865 0 1.544752-0.06497 2.147924-0.194212 0.602511-0.12993 1.167802-0.325234 1.695611-0.58482 0.22609-1.741217 0.841668-3.078863 1.846206-4.013891-1.431773-0.155588-2.719023-0.389925-3.862409-0.701509-1.142727-0.311994-2.323595-0.818337-3.541817-1.520393-1.218881-0.7011-2.230019-1.571709-3.033676-2.610326-0.803788-1.039162-1.463449-2.403421-1.978059-4.091548-0.514873-1.688809-0.772375-3.636932-0.772375-5.844913 0-3.143828 0.992527-5.819119 2.977185-8.027373-0.929702-2.363569-0.841932-5.013201 0.263574-7.948624 0.728557-0.234064 1.808987-0.05841 3.24076 0.52586 1.432036 0.584546 2.480525 1.085293 3.146522 1.500467 0.665996 0.415037 1.199612 0.766747 1.601637 1.051991 2.336794-0.675169 4.748292-1.012822 7.235153-1.012822s4.898887 0.337653 7.235813 1.012822l1.431905-0.934755c0.979196-0.623715 2.135518-1.195296 3.46619-1.714878 1.331465-0.519307 2.349596-0.662339 3.05334-0.428275 1.130056 2.935559 1.230761 5.585055 0.300794 7.948624 1.984527 2.208254 2.97745 4.884227 2.97745 8.027373 0 2.207981-0.258427 4.162245-0.772509 5.864021-0.514741 1.702047-1.180078 3.064941-1.996272 4.091547-0.817119 1.026469-1.834725 1.890255-3.052945 2.591219-1.218486 0.701509-2.399751 1.207852-3.542477 1.519846-1.143254 0.311995-2.430503 0.546468-3.862277 0.702328 1.305859 1.168547 1.958921 3.01308 1.958921 5.532784v8.221174c0 0.467037 0.157063 0.856961 0.471451 1.168547 0.313992 0.311039 0.80986 0.402617 1.488262 0.272279 5.828854-1.99985 10.583217-5.604163 14.263618-10.812804 3.679742-5.208232 5.520272-11.072116 5.520272-17.593699-0.0012-5.427966-1.295828-10.434479-3.882206-15.019678z" fill="#f00" stroke-width=".13421392"/>
</svg>