The native HTML DOM has the quirky behavior of upper-casing the nodeName property of any element in the HTML namespace. Unfortunately, by default FontoXPath uses the nodeName in order to clone elements (see https://github.com/FontoXML/fontoxpath/blob/master/src/domClone/deepCloneNode.ts#L42). The result is that when run against a DOM implementation that follows this behavior, such as the native DOM in browsers, cloned nodes unintentionally have their localName and (if applicable) prefix upper-cased relative to their originals.
Consider the following example, ran against the XPath playground with e aliased to evaluateUpdatingExpression (using a temporary breakpoint):
(await e('//*:fds-state-message', document.documentElement)).xdmValue[0].localName
> "fds-state-message"
(await e('<div>{//*:fds-state-message}</div>', document.documentElement)).xdmValue[0].firstChild.localName
> "FDS-STATE-MESSAGE"
I think the easiest way to avoid this would be to re-implement the nodeName construction ourselves in DomFacade#getNodeName (https://github.com/FontoXML/fontoxpath/blob/master/src/domFacade/DomFacade.ts#L244), at least for element nodes, by combining the node's prefix (if present) with its localName.
The native HTML DOM has the quirky behavior of upper-casing the
nodeNameproperty of any element in the HTML namespace. Unfortunately, by default FontoXPath uses thenodeNamein order to clone elements (see https://github.com/FontoXML/fontoxpath/blob/master/src/domClone/deepCloneNode.ts#L42). The result is that when run against a DOM implementation that follows this behavior, such as the native DOM in browsers, cloned nodes unintentionally have theirlocalNameand (if applicable)prefixupper-cased relative to their originals.Consider the following example, ran against the XPath playground with
ealiased toevaluateUpdatingExpression(using a temporary breakpoint):I think the easiest way to avoid this would be to re-implement the
nodeNameconstruction ourselves inDomFacade#getNodeName(https://github.com/FontoXML/fontoxpath/blob/master/src/domFacade/DomFacade.ts#L244), at least for element nodes, by combining the node'sprefix(if present) with itslocalName.