Fixed error in Firefox: TypeError: Argument 1 of Node.contains does not implement interface Node.