jquery-simulate
jquery-simulate copied to clipboard
Null relatedTarget in HtmlUnit
Very useful project!
I find that when running tests with jasmine-maven-plugin, specifically when running a headless test (which internally uses HtmlUnit for the "browser") that event.relatedTarget can be null. This throws on line 118 which tries to get event.relatedTarget.ownerDocument. The same thing works fine when testing inside a browser.
My fix is: eventDoc = event.relatedTarget ? event.relatedTarget.ownerDocument : undefined || document;