add comment explaining onload choice

This commit is contained in:
Christopher Willis-Ford 2021-06-29 13:25:20 -07:00 committed by GitHub
parent 7af5b3e207
commit 3b21ee98b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -197,6 +197,7 @@ class SVGSkin extends Skin {
const svgText = serializeSvgToString(svgTag, true /* shouldInjectFonts */);
this._svgImageLoaded = false;
// If there is another load already in progress, replace the old onload to effectively cancel the old load
this._svgImage.onload = () => {
const {x, y, width, height} = svgTag.viewBox.baseVal;
this._size[0] = width;