I have the following animation with svg, but they handled completely different on safari and chrome.
let time;
document.querySelector('text').addEventListener('animationstart', () => time = performance.now())
document.querySelector('text').addEventListener('animationend', () => console.log(performance.now() - time))
svg {
width: 100vw;
height: 50vh;
}
@keyframes draw {
to {
stroke-dashoffset: 0;
fill: black;
}
}
text {
stroke-dasharray: 1000;
stroke-dashoffset: 1000;
animation: draw 5s forwards;
font-style: italic;
}
<svg>
<text fill='none' x="50%" y="50%" text-anchor="middle" stroke="black" stroke-width="5.5" font-size="110">Example</text>
</svg>
On safari, the animation will finish animating the stroke-dashoffset:0 almost close to the JS event print the finished ( 5s which I set), but on chrome, the animation will finish much faster (about 3 or 2 s).
It will wait for several seconds for the animationend event to fire.
Also, the fill property on safari will not work at all.
What looks like in safari (with no fill black):

My questions:
Why the two broswers handle animation differently and why the fill doesn't work as expected in Safari?
What am I missing?