Fix for "TypeError: Argument 1 of Window.getComputedStyle does not implement interface Element."

I got that error on canvas element, and the reason was that because of event bubbling event comes to `document` where this method fails.
Did not tested for error `TypeError: Argument 1 of Window.getDefaultComputedStyle does not implement interface Element.` but it may fix it in some cases as well.