DOMParser APIs hasAttribute and getAttribute not available in FIGMA?

Hi, I am developing a FIGMA plugin to export layer data into XML . While using DOMParser APIs in ui.html like hasAttribute and getAttribute to access XMLAttribute of a xmlElement, received an error “Exception in converting string to XMLTypeError: child.hasAttribute is not a function”. Here child is a valid XML element.
It will be great helpful to share any idea to resolve this issue?

Sample code to reproduce this issue:

Thanks in advance

Sample code