load() fails to retrieve image width and height correctly when styling images with CSS
I have a web page where several images are rendered in a tabbed view. On page load the image in the default tab is being processed correctly. However, when the tab is switched, the width and height values are corrupted, with width returning 80 and height returning NaN.
I suspect the issue might arise from the fact that my images have no explicit width and height tag; rather, width and height are defined in CSS using width:80%; height: auto'. The return values from the CSS resemble the corrupted ones (80% and auto-> 80 andNaN. Perhaps the getComputedStyle` function cannot parse the values correctly.
This is supported by the fact that when I declared width and height explicitly in the img tag, the issue went away.