allow tagName to be function