Replace instanceof checks with other logic

This commit is contained in:
ahocevar
2018-10-05 16:16:51 +02:00
parent 96e99e481e
commit 9163558511
40 changed files with 232 additions and 268 deletions
+1 -4
View File
@@ -230,10 +230,7 @@ class ImageSource extends Source {
* @param {string} src Source.
*/
export function defaultImageLoadFunction(image, src) {
const img = image.getImage();
if (img instanceof HTMLImageElement || img instanceof HTMLVideoElement) {
img.src = src;
}
/** @type {HTMLImageElement|HTMLVideoElement} */ (image.getImage()).src = src;
}