null check element before matching to prevent illegal invocation on disconnected fragments
add tests exercising detached node case
Merge pull request #2 from treygriffith/master

Prevent illegal invocation by avoiding the null parentNode