LiquidPlayer / LiquidCore

Node.js virtual machine for Android and iOS
MIT License
1.01k stars 127 forks source link

[Android] When I use jsdom library, I get: TypeError: DOMImplementation.createImpl is not a function #189

Open mmaciejow opened 3 years ago

mmaciejow commented 3 years ago

Hi, I 'm trying to create DOM object. I use jsdom. My example.js: `const {LiquidCore} = require("liquidcore"); const jsdom = require("jsdom"); const JSDOM = jsdom.JSDOM;

setInterval(()=>{}, 1000)

console.log("Hello, World!")

LiquidCore.on( "ping", () => { try { var html = "\ \

H2\

\

P\

<\div>Div\
\"; var dom = new JSDOM(html).window.document; console.log(dom ); } catch (error) { console.error(error); }

LiquidCore.emit( "pong", { message: "Hello World!" } )
process.exit(0)

}) LiquidCore.emit( "ready" )`

I get error:

TypeError: DOMImplementation.createImpl is not a function at new DocumentImpl (example.bundle.js:72927:48) at Object.exports.setup (example.bundle.js:64989:14) at Object.exports.create (example.bundle.js:64937:20) at Object.exports.createImpl (example.bundle.js:64941:29) at Object.exports.createImpl (example.bundle.js:64736:21) at Object.exports.createWrapper.args [as createWrapper] (example.bundle.js:64742:35) at new Window (example.bundle.js:23535:32) at exports.createWindow (example.bundle.js:23461:12) at new JSDOM (example.bundle.js:2109:22) at LiquidCore.on (example.bundle.js:245:17)

When I run node test.js: const jsdom = require("jsdom"); const JSDOM = jsdom.JSDOM; var html = "\<body> \<h2>H2\</h2>\<p>P\</p><\div>Div\</div>\</body>"; var dom = new JSDOM(html).window.document; console.log(dom );

Works. Where is the problem? How can I fix it? Thanks for help :)