Added more robust node detection code

Previously, if we remove the node from a click event (e.g. use Command
extension), `triggerToggleStrategy` and `triggerNode` would throw
ReferenceError, so now we detect wether node element exists in a lot of
places