Moved the hasClass method from TraversableElement to NodeElement

Calling it on a DocumentElement would have triggered a fatal error because
its implementation relies on NodeElement methods.