You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using Koa2 ctx.body = doc which will fail with the error msg
TypeError: Converting circular structure to JSON
I used the example from your Readme:
var domino = require('domino');
var domimpl = domino.createDOMImplementation();
var doc = domimpl.createHTMLDocument();
Using a simple ctx.body="<html></html>" works fine.
I am using node v7.7.3 and Koa2.
Is this behavior known - and is it possible to work around this using Koa2 ?
(of cause: maybe I am using your work in a wrong way - please give me a hint 😄 )
Anyways: Thanks for publishing/sharing your work!
The text was updated successfully, but these errors were encountered:
Trying to set the body field to a Document is not going to work. When you try this in a brower's JavaScript console, you get:
> d = document.implementation.createHTMLDocument()
#document
> document.body = d
VM150:1 Uncaught TypeError: Failed to set the 'body' property on 'Document': The provided value is not of type 'HTMLElement'.
at <anonymous>:1:15
Arguably domino should be more careful and throw a TypeError if you try this.
You probably want to be doing something involving adoptNode.

cscott
changed the title
TypeError: Converting circular structure to JSON
Should throw TypeError when assigning Document to doc.body.
Mar 28, 2017
Hello,
I am using Koa2
ctx.body = doc
which will fail with the error msgI used the example from your Readme:
Using a simple
ctx.body="<html></html>"
works fine.I am using node
v7.7.3
and Koa2.Is this behavior known - and is it possible to work around this using Koa2 ?
(of cause: maybe I am using your work in a wrong way - please give me a hint 😄 )
Anyways: Thanks for publishing/sharing your work!
The text was updated successfully, but these errors were encountered: