From 43d2912363f8ee6f7bf6315b4c850af425ce1441 Mon Sep 17 00:00:00 2001 From: Brent Burgoyne Date: Tue, 24 Sep 2019 18:56:09 -0600 Subject: [PATCH] fix zero width for cached images in firefox refs CNVS-47040 test plan: - create a wiki page with an image - save it - load the page with cache disabled - load the page with cache enabled - both should show the image Change-Id: I20725690030942b3225b227c097465e61b098789 Reviewed-on: https://gerrit.instructure.com/210893 Reviewed-by: Clay Diffrient Tested-by: Jenkins QA-Review: Jeremy Putnam Product-Review: Brent Burgoyne --- public/javascripts/instructure.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/javascripts/instructure.js b/public/javascripts/instructure.js index 7eb5b2e89c1..70c89dd2346 100644 --- a/public/javascripts/instructure.js +++ b/public/javascripts/instructure.js @@ -109,7 +109,7 @@ function handleYoutubeLink () { .each(function() { var $this = $(this); $this.find("img").each((i, img) => { - const handleWidth = () => $(img).css('maxWidth', Math.min($content.width(), $this.width(), $(img).width())); + const handleWidth = () => $(img).css('maxWidth', Math.min($content.width(), $this.width(), $(img).width() || img.naturalWidth)); if (img.naturalWidth === 0) { img.addEventListener('load', handleWidth); } else {