Rather than faking, Envjs actually implements the APIs so that they work.
That's very cool. I just had to get this running on QtScript, and here's the result of two nights of hacking:
The README has the pertinent details; in short, you evaluate the Envjs implementation (env.js), call a function to register the native Envjs/QtScript handlers (for network & file access, asynchronous function execution, and a few more things), and presto -- instant browser environment.
examples/document.js in the repository:
And, yay, prototype.js works:
var my_div = document.createElement('div'); my_div.addClassName('prototyped').hide(); document.body.appendChild(my_div); console.log("document.innerHTML:", document.innerHTML);
document.innerHTML: <html><head/><body><div class="prototyped"/></body></html>
(jQuery 1.5.1 unfortunately fails with the error
Result of expression 'ajaxLocParts' [null] is not an object.)
Well, Envjs version 1.2 is 680KB (unminified), so evaluating it isn't free. It's another tradeoff to consider. With V8, it would be possible to inject Envjs into the standard environment and serialize all of it, with the prospect of vastly reducing initialization time.
This project is open for merge requests. Not all of the native integration is implemented yet, and the XMLHttpRequest implementation could be improved. There's also the XML parsing issue (maybe an existing lightweight parser could be used instead of relying on E4X?).
Download the latest release here: www.qt.io/download.
Qt 5.15 was developed with a strong focus on quality and is a long-term-supported (LTS) release that will be supported for 3 years.
Check out all our open positions here and follow us on Instagram to see what it's like to be #QtPeople.
Näytä tämä julkaisu Instagramissa.
Want to build something for tomorrow, join #QtPeople today! We have loads of cool jobs you don’t want to miss! http://qt.io/careers #builtwithQt #software #developers #coding #framework #tool #tooling #C++ #QML #engineers #sales #tech #technology #UI #UX #CX #Qt #Qtdev #global #openpositions #careers #job
Henkilön Qt (@theqtcompany) jakama julkaisu