remove undef usage in element_proxy and use define_method instead
remove undef usage in document_proxy and use define_method instead