fixes #887 - account for IE7 bug in Node.contains which results in an error if the parameter is undefined