Fixed access to undefined methods in exception classes
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.