Validate variable not undefined

Validating that selectorClass is not undefined to prevent error while searching for object parentNode.