Refactored Code.util.isElement()