img.parentNode is null in IE10, viewed in IE8 Compatibility Mode

We have a SAAS product where we are forced to use IE8 compatibility mode, since one of our JS components don't play nice in higher versions of IE. However, in this case the automatic image dimensions detection doesn't work now while inserting an image in a TinyMce editor. The proposed commit fixes this issue.