jsdom v1.0.0-pre.1 Release Notes
-
๐ This is a prerelease of jsdom's first major version. It incorporates several great additions, as well as a general cleanup of the API surface, which make it more backward-incompatible than usual. Starting with the 1.0.0 release, we will be following semantic versioning, so that you can depend on stability within major version ranges. But we still have a few more issues before we can get there, so I don't want to do 1.0.0 quite yet.
๐ This release owes a special thanks to @Sebmaster, for his amazing work taking on some of the hardest problems in jsdom and solving them with gusto.
Major changes
- ๐ท jsdom now can be browserified into a bundle that works in web workers! This is highly experimental, but also highly exciting! (lawnsea)
- An overhaul of the initialization lifecycle, to bring more control and address common use cases. (Sebmaster)
- ๐ฆ The excellent parse5 HTML parser is now the default parser, fixing many parsing bugs and giving us full, official-test-suite-passing HTML parsing support. This especially impacts documents that didn't include optional tags like
<html>
,<head>
, or<body>
in their source. We also use parse5 for serialization, fixing many bugs there. (Sebmaster) - ๐ As part of the new parser story, we are not supporting XML for now. It might work if you switch to a different parser (e.g. htmlparser2), but in the end, HTML and XML are very different, and we are not attempting to be an XML DOM. That said, we eventually want to support XML to the same extent browsers do (i.e., support XHTML and SVG, with an appropriate MIME type switch); this is being planned in #820.
โ Removed jsdom APIs
jsdom.createWindow
: usedocument.parentWindow
after creating a documentjsdom.html
: usejsdom.jsdom
- ๐ฆ
jsdom.version
: userequire("jsdom/package.json").version
- ๐
jsdom.level
: levels are deprecated and will probably be removed in 2.0.0 jsdom.dom
- ๐ป
jsdom.browserAugmentation
jsdom.windowAugmentation
๐ Changed jsdom APIs
jsdom.jsdom
no longer takes a level as its second argument.- โ
jsdom.jQueryify
now requires a jQuery URL, since always picking the latest was a bad idea.
โ Removed non-standard DOM APIs
document.createWindow
: usedocument.parentWindow
document.innerHTML
anddocument.outerHTML
: use the newjsdom.serializeDocument
to include the DOCTYPE, or usedocument.documentElement.outerHTML
to omit it.
๐ Other fixes
- ๐ Allow empty strings to be passed to
jsdom.env
. (michaelmior) - ๐ Fix for a memory leak in
EventTarget.prototype.dispatchEvent
. (Joris-van-der-Wel) - ๐ Make event listeners in the capture phase also fire on the event target. (Joris-van-der-Wel)
- Correctly reset
eventPhase
andcurrentTarget
on events, before and after a dispatch. (Joris-van-der-Wel) - ๐ Fix
document.cookie = null
to not throw, but instead just do nothing. (kapouer)