-
-
Notifications
You must be signed in to change notification settings
doc.write
is not working as browsers
#3699
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This issue does not follow the issue template, and as such is not something we can help with. If you edit it to do so, and leave a comment here, we can consider reopening. |
@domenic done. Please re-open the issue |
This still does not follow the issue template, in particular this part: <!--
Please create a minimal repro. Any reports involving third party libraries
will be closed, as we cannot debug third-party library interactions for you.
Please do not use syntax that is not supported in Node.js, such as JSX. If
we cannot run the code in Node.js, we will close the issue, as we cannot
debug whatever toolchain you are using.
TO BE CLEAR: your example needs to be self-contained enough that we can
copy-paste it into a file named `test.js`, and then run it using
`node test.js`. *No* Jest or similar.
IF YOU DO NOT FOLLOW THESE INSTRUCTIONS WE WILL CLOSE THE ISSUE.
-->
```js
const { JSDOM } = require("jsdom");
const options = {
... your options here ...
};
const dom = new JSDOM(`
... your HTML here ...
`, options);
... your code that reproduces the problem here, probably using dom.window ...
```
|
I already shared the code, you can copy&paste to devtools to see the browser behavior or inside a jsdom test. What do you want more? |
I'll stop engaging after this response because this is exceeding the amount of time I've allocated to providing free support for people who aren't able to follow instructions. When I paste the code you supplied into a file named
|
Let's see, I have put the version to work in the browsers as well so that it is easy to check it. In jsom add it inside a test async. +test('', async () => {
const doc = document.implementation.createHTMLDocument();
const encoder = new TextEncoder();
const decoder = new TextDecoder();
const readable = new ReadableStream({ start: (controller) => {
controller.enqueue(encoder.encode('<div>'));
controller.enqueue(encoder.encode('text a'));
controller.enqueue(encoder.encode("text c"));
controller.enqueue(encoder.encode("</div>"));
controller.close();
}});
const reader = readable.getReader();
while(true) {
const { done, value } = await reader.read();
if(done) break
doc.write(decoder.decode(value));
console.log(doc.documentElement.outerHTML)
}
+}) However if you put it in devtools to see how it works in the browsers it will not work because they do not support "test" in the browsers. That's why I've put the code to work everywhere. Also to work with const { JSDOM } = require("jsdom");
const dom = new JSDOM("<!DOCTYPE html><html><body></body></html>");
global.document = dom.window.document;
global.window = dom.window; on top. You also need a Do whatever you want, I have reported it to help the jsom library, I don't understand why I have been received so negatively. |
I opened a new one with more details #3700 I hope this work |
Basic info:
Minimal reproduction case
Run this code:
In JSDOM:
How does similar code behave in browsers?
In Chrome:
In Safari:
In Firefox:
The text was updated successfully, but these errors were encountered: