null check element before matching to prevent illegal invocation on disconnected fragments
add tests exercising detached node case