Fix for Issue 2998 – "Consider using `window.parent !== window` instead of `!!window.frameElement`"

I hope this fixes the issue. This is my first pull request, so I hope I didn't do anything wrong.