💣 Breaking Changes
- This is a big release where a lot of the code has been refactored to improve security and to be able to support the new Browser API. A big release is always a potential risk for bugs and therefore it make sense to make this a major release to avoid that consumers automatically updates to it. (#466)
🎨 Features
- Adds support for a Browser API similar to Puppeteer and Playwright. With the Browser API, it is for example possible to create new pages and navigate in them. You can read more about it in the Happy DOM Wiki. (#466)
- Improves security by not exposing sensitive internal logic to scripts running within the Happy DOM Browser. (#466)
- Improves support for CORS management. It now supports "OPTIONS" requests to detect if the client is allowed to proceed with a cross origin request. (#466)
- Adds support for HTTP response cache. The cache is in memory, but the plan is to add support for storing it on disk in the future. (#466)
- Improves support for
XMLHttpRequest
. It now supports the GZip, Deflate and Brotli encodings. (#466) - Adds support for adding a process level error event listener for capturing errors. This is useful when using the Browser API, but will not work in environments such as Jest and Vitest, as it collides with their error listener. (#466)
- Adds support for
Ẁindow.open()
. (#466) - Adds support for
Ẁindow.close()
. This function should now be used when tearing down the environment. (#466) - Improves support for cookies. (#466)
- Improves support for
HTMLIFrameElement
. (#466) - Changes export of types to use "import type" and "export type" in "index.js". This will allow transpilers/compilers to optimize better. (#466)
- Adds support for navigating when clicking on an anchor link. (#466)
- Adds support for navigating when setting
Location.href
. (#466) - Improves support for
MutationObserver
. It will now queue multiple records by using a microtask. It now also supportsMutationObserver.takeRecords()
for records that has not yet been published. (#466) - Deprecates "@happy-dom/uncaught-exception-observer" as the functionality is supported by "happy-dom" out of the box now. (#466)
- Changes internal properties to use
Symbol
instead of using "_" as a prefix, so they won't be enumerable. This will also make sure that these properties won't clash with properties defined by the consumer. It will use private properties with#
where it is possible. (#466)
👷♂️ Patch fixes
- Improves the check for if the property is a class to avoid that it gets bound in "@happy-dom/global-registrator". We only want functions to get bound to the global context. (#466)
- Fixes bug where
new Document()
didn't work according to spec. (#466) - Fixes bug where several Element classes wheren't available as properties on
Window
. (#466) - Fixes bug in
Document.importNode()
where it didn't changeownerDocument
on child nodes. (#466) - Resets static
ownerDocument
state used when creating Node instances, so that it can be garbage collected if not used anymore. (#466)
Merry Christmas and a Happy New Year! 🎅 ✨
This release took some time as I didn't want to release the Browser API without applying security fixes. I've also stumbled across a few other issues along the way that I felt I needed to address.
I hope you will enjoy the release!