Steps to repro:Create a jscript Form A with the following code attached to a button OnClick event handler:
var oXDoc = Application.XDocuments.NewFromSolutionWithData(XDocument.DOM.documentElement, sSharePointTemplate, 1);
where sSharePointTemplate refers to the xsn in your form library, for example: ...