MicrosoftEdge / MicrosoftEdge/WebView2Feedback
Unable to import element from an msxml2 domdocument into one passed in from the parent page
Nobody has claimed this yet.
- Dominant language
- PowerShell
- Stars
- 526
- Forks
- 67
- PR merge metrics
- No merged PRs in 30d
Description
When using the native webview2 component, we've got a situation where one page is opening another using window.open, and it's passing in an element from an MSXML2.DomDocument COM object to the child page. From the child page, properties on that element and its DOM can be accessed, such as ownerDocument and xml, with no problem. However, we're also attempting to insert nodes from a new DomDocument into the one passed in, and that operation is failing with this error:
Uncaught (in promise) Error: Type mismatch. (0x80020005)
at RemoteMessenger.postSyncRequestMessage (:1:15626)
at Function.applyHostFunction (:1:31934)
at Object.apply (:1:21831)
This is when using the WPF version of WebView2
The code that is failing in the child page:
var newDOM = CreateObject("MSXML2.DOMDocument.6.0");
newDOM.loadXML(someValidXML);
incomingNode.appendChild(newDOM.documentElement); // This fails with error
Things I've tried with no success and it produces the same error:
- Using MSXML2.DOMDocument, MSXML2.DOMDocument.3.0, and MSXML2.DOMDocument.6.0
incomingNode.appendChild(newDOM.documentElement);incomingNode.appendChild(newDOM.documentElement.cloneNode(true));incomingNode.ownerDocument.importNode(newDOM.documentElement);
Versions of WebView2 used
- 1.0.1264.42
- 1.0.817.41
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.