Hah, actually that code is correct (Although I realise it probably looks like gobbledygook :D) so it disproves my theory.
The code is mostly arithmetic, so the only thing I can see which could be implementation sensitive is the canvas fillStyle HSL string, which omits commas and spaces since the % postfixes are enough to delimit the saturation and luminance, but obviously this depends on the canvas interface implementation.
I looked into it and this turned out to be the problem exactly.
If you change the part of your code where you have
hsl(${i*120} 99%${K*99}%
To instead
hsl(${i*120} 99% ${K*99}%
(That is, by not omitting the space after 99%)
Then it works in the versions of Safari that I tested; Safari 14.0.3 on macOS Big Sur 11.2.2 running on a MacBook Pro M1, and Safari on iOS 14.4 running on an iPhone X.
The code is mostly arithmetic, so the only thing I can see which could be implementation sensitive is the canvas fillStyle HSL string, which omits commas and spaces since the % postfixes are enough to delimit the saturation and luminance, but obviously this depends on the canvas interface implementation.