better fix for delegateTagNameListener, when getElementParentElement returns null within loop