NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
npm · #451 most downloaded on npm
A JavaScript implementation of many web standards
Last release 9 days ago
22 Sep 2026
Release timing varies
gaps range from 2 weeks to 3 months
Nearly every release is documented
notes for 60 of the last 60 stable releases
Nothing withdrawn
no release was ever pulled
15 years old
287 releases · first in 2011
Added an implementation of the TreeWalker class (and document.createTreeWalker). (@garycourt)
TreeWalker class (and document.createTreeWalker). (@garycourt)URL API, by upgrading to whatwg-url v2.0.1.Fixed an issue where if you modified Object.prototype, spurious attributes would show up on your jsdom nodes. (@deckar01)
Object.prototype, spurious attributes would show up on your jsdom nodes. (@deckar01)One column per quarter.
Added image loading and decoding, when the canvas npm package is installed (lehni). In practice, this means that if you enable fetching "img" external
canvas npm package is installed (lehni). In practice, this means that if you enable fetching "img" external resources, then:
img.naturalWidth, img.naturalHeight, img.width, img.height, img.complete, and img.currentSrc will update themselves correctly as the image loadsload and error events will fire on the <img> element, according to how well image decoding goes.canvasContext.drawImage API.canvasContext.createPattern and canvasContext.toBlob, when the canvas npm package is installed. (@lehni)document.hidden property that always returns true, and a document.visibilityState property that always returns "prerender". This is a more standard alternative to our proprietary navigator.noUI, which will be removed whenever we release v9.0.0. (@kapouer)Fixed input selection methods and properties to properly differentiate between inputs that can be selected outright vs. textual inputs which allow var
change and input events now fire appropriatelystrictSSL top-level option to govern all requests jsdom makes. (@nicolashenry)document.origin and document.lastModified. (@nicolashenry)scriptEl.text getter and setter to follow the spec.Added attr.nodeName, which was recently re-added to the spec.
attr.nodeName, which was recently re-added to the spec.<label>s to their labeled form elements. (@yaycmyk)element.classList per recent spec changes (it forwards to element.classList.value).element.getAttributeNames(). (spec addition)setAttributeNode and setAttributeNodeNS can now replace an attribute node, instead of removing the old one and adding a new one; this avoids changing the order in the attribute list. (spec change)NamedNodeMap named properties are now lowercase (except in edge cases involving XML documents or non-HTML elements). (spec change)NamedNodeMap named properties are now non-enumerable."DOMAttrModified" mutation event's relatedNode is now the new Attr object, not the Node, as per spec.DOMTokenList to have a value property per recent spec changes; its toString serialization also changed slightly.tc.headers to be a DOMTokenList that simply reflects the headers attribute; previously it was a string, with its computation doing some weird stuff.document.implementation.createDocument() to create a document with its parsing mode set to XML, which affects a variety of DOM APIs in small ways.EventTarget.prototype.constructor to be correct; it was previously Window.option.index for <option>s not inside a <select> to no longer error.tc.cellIndex for <td>s and <th>s not inside a <tr> to no longer error.tr.sectionRowIndex for <tr>s not inside a <table>, <tbody>, <thead>, or <tfoot> to no longer error."keyevents" alias for "keyboardevent" when using document.createEvent, per recent spec changes.Fixed the this value when you pass a { handleEvent() { ... } } object to addEventListener. (@thetalecrafter)
this value when you pass a { handleEvent() { ... } } object to addEventListener. (@thetalecrafter)Fixed HTMLOptionElement.prototype.label; a typo was causing it to not work at all. (@karlhorky)
HTMLOptionElement.prototype.label; a typo was causing it to not work at all. (@karlhorky)cssstyle minimum version to ensure all jsdom installs (not just fresh ones) get the benefit of cssstyle's recently-better padding and margin parsing/CSSOM.Fixed an issue where custom user agents would not propagate to navigator.userAgent in frames and iframes.
navigator.userAgent in frames and iframes.document.activeElement implementation to be a bit smarter; we still don't have full focus/blur/active element semantics, but at least now it falls back to the <body> element when the active element is removed from the document or when no element has been focused yet.Fixed an issue where the this inside event handler callbacks was not equal to the event's current target. (Surprisingly there were no tests for this!)
this inside event handler callbacks was not equal to the event's current target. (Surprisingly there were no tests for this!)This major release includes a large rewrite of most of the DOM and HTML classes exposed in jsdom. A lot of their behavior is generated from their spec
This major release includes a large rewrite of most of the DOM and HTML classes exposed in jsdom. A lot of their behavior is generated from their specs' IDL syntax, taking care of many type conversions, attribute/property reflections, and much more. Many properties that were previously not present are now available, and almost everything behaves in a more spec-compliant way. Additionally, for these classes all of their implementation details are no longer available as underscore-prefixed properties, but instead are hidden behind a single symbol.
Although normally jsdom does not mark a new major release for changes that simply update us to the latest specs or hide internal implementation details better, the magnitude of the changes is so extensive that we want to bump the major version in order to ensure that consumers perform adequate testing before upgrading. But, you should definitely upgrade! The new stuff is really awesome!
Location, History, and HTMLHyperlinkElementUtils (used by both HTMLAnchorElement and HTMLAreaElement) according to the latest specs, and using the latest whatwg-url package. This greatly improves our correctness on URL resolution and navigation (to the extent we support navigation, i.e. pushState and changing the hash). It should also improve parsing speed as we no longer parse and resolve URLs during parsing.Element.prototype.insertAdjacentHTML. (@kasperisager)Node.prototype.adoptNode, and adopt nodes during insertion instead of throwing "WrongDocumentError"s. (@dmethvin)Element.prototype.getClientRects to match our stub getBoundingClientRect.setTimeout and setInterval to return numeric IDs, instead of objects. (@alvarorahul)setTimeout and setInterval to accept string arguments to eval, and to pass along extra arguments after the first two.Event object creation to always initialize the event objects, unless using document.createEvent, even for events with name "".DOMError, DOMConfiguration, and DOMStringList.Nothing published for this version
Fixed canvasEl.toDataURL(), with the canvas npm package installed; a recent update to the canvas package broke how we were passing arguments to do.
canvasEl.toDataURL(), with the canvas npm package installed; a recent update to the canvas package broke how we were passing arguments to do.data: URL parsing to allow empty contents, e.g. data:text/css;base64,. (@sebmck)Fixed a regression in XML parsing of attributes with a namespace URL but no prefix (e.g. ).
<math xmlns="http://www.w3.org/1998/Math/MathML">).Added support for text selection APIs on and ! (sjelin and yaycmyk)
<input> and <textarea>! (sjelin and yaycmyk)<canvas> tag to reset its contents when its width or height changed, including the change from the default 300 × 150 canvas. (Applies only when using the canvas npm package.)HTMLCollections would get confused when they contained elements with numeric ids or names.postMessage use the inside-jsdom timer queue, instead of the Node.js one. This allows easier mocking. (@cpojer)When s have unresolvable URLs, jsdom will no longer crash, but will instead just load about:blank into them. (This is the spec behavior.)
<iframe>s have unresolvable URLs, jsdom will no longer crash, but will instead just load about:blank into them. (This is the spec behavior.)document.writeln to correctly handle multiple arguments; previously it ignored all after the first.FileList objects to no longer have a property named "undefined". (@jfremy)This is a rather large release bringing with it several important re-implementations of DOM and HTML APIs.
This is a rather large release bringing with it several important re-implementations of DOM and HTML APIs.
EventTarget implementation has been rewritten from scratch to follow the spec exactly. This should improve any edge case misbehaviors.Event class hierarchy has been rewritten and fleshed out, fixing many gaps in functionality.
KeyboardEvent and TouchEvent are now implemented.Event subclasses now have constructors. (TouchEvent does not yet, and MutationEvent is specified to not have one.)document.createEvent("customevent", ...) now correctly creates a CustomEvent instead of an Event, and CustomEvent.prototype.initProgressEvent has been replaced with CustomEvent.prototype.initCustomEvent.Attr class and related attribute-manipulating methods has been rewritten to follow the latest specification. In particular, Attr is no longer a subclass of Node, and no longer has child text nodes.<template> element implementation has been greatly improved, now passing most web platform tests. Its .content property no longer has an extra intermediate document fragment; it no longer has child nodes; and related parts of the parser and serializer have been fixed, including innerHTML and outerHTML, to now work as specified.querySelector, querySelectorAll, and matches now correctly throw "SyntaxError" DOMExceptions for invalid selectors, instead of just Error instances.Node.prototype's insertBefore, replaceChild, and appendChild methods now check their arguments more correctly.Fixed an issue where inside jsdom code, /regexpliteral/ instanceof RegExp would be false.
<script> code, /regexpliteral/ instanceof RegExp would be false.Fixed two bugs with Node.prototype.isEqualNode:
Node.prototype.isEqualNode:
true for comparing any two doctypes.document.implementation.createDocumentType requires all three of its arguments.It includes a number of other smaller improvements and fixes. The breaking changes are highlighted in bold below.
This major release has as its headlining feature a completely re-written XMLHttpRequest implementation, in a heroic effort by @nicolashenry. It includes a number of other smaller improvements and fixes. The breaking changes are highlighted in bold below.
XMLHttpRequest and related classes (nicolashenry):
Blob, File, FileList, FileReader, FormData, ProgressEvent, and the supporting XMLHttpRequestUpload, and XMLHttpRequestEventTarget interfaces.pool, agentOptions, and userAgent options are new, and resource loads can now be aborted.document.charset, an alias for document.characterSet.HTMLTemplateElement.prototype.content, for getting the contents of a <template> element as a document fragment. (@rickychien)document.cookie = "foo".Event.prototype.stopImmediatePropagation and the constants NONE, CAPTURING_PHASE, AT_TARGET, and BUBBLING_PHASE. This accounted for another 15 newly-passing web platform tests. (@nicolashenry)document.styleSheets to correctly track the removal of stylesheets from the document. (@AVGP)created jsdom lifecycle callback receiving a different window object than the loaded or done callbacks when scripting was enabled.{ omitJsdomErrors } option of the virtual console has moved; it is no longer provided when creating the virtual console, but instead when calling sendTo.Fixed an issue where with jsdom.jsdom, you had to pass referrer and cookie options as top-level, whereas with jsdom.env, you had to nest them under a
jsdom.jsdom, you had to pass referrer and cookie options as top-level, whereas with jsdom.env, you had to nest them under a document option. This was unnecessarily confusing. Now both possibilities are allowed for both functions. (The readme only documents the top-level version, though.)Added NodeList.prototype[Symbol.iterator], so you can now use for-of loops with NodeLists.
NodeList.prototype[Symbol.iterator], so you can now use for-of loops with NodeLists.Added jsdom.nodeLocation(node) to get the location within the source text of a given node.
jsdom.nodeLocation(node) to get the location within the source text of a given node.jsdom.reconfigureWindow(window, { top }) to allow changing the value of a window's top property.element argument to the custom resource loader, so you can customize resource loads depending on which element loaded them.getElementsByClassName to match the spec. It now correctly splits on whitespace to try to find elements with all the given classes; it returns a HTMLCollection instead of a NodeList; and it memoizes the result.NodeList and HTMLCollection to match the spec. The most noticable change is that HTMLCollection no longer inherits from NodeList.Added a fully spec-compliant implementation of window.atob and window.btoa. (@jeffcarp)
window.atob and window.btoa. (@jeffcarp)<canvas> implementation:
canvas npm package installed, <canvas> elements are now properly instanceof HTMLCanvasElement and instanceof HTMLElement.<canvas> elements now present the same uniform spec-compliant API both with and without the canvas npm package installed. If the package is not installed, some of the methods will cause not-implemented jsdomError events to be emitted on the virtual console.width and height properties now correctly reflect the width and height attributes, and have the appropriate default values of 300 and 150.canvas npm package installed, <canvas> elements now generally play better with other parts of jsdom, e.g., document.getElementById actually works with them.HTMLDataElement, HTMLSpanElement, and HTMLTimeElement.HTMLDataListElement, HTMLDialogElement, HTMLEmbedElement, HTMLMeterElement, HTMLOutputElement, HTMLProgressElement, HTMLSourceElement, HTMLTemplateElement, and HTMLTrackElement.HTMLAudioElement was implemented in full, although its HTMLMediaElement base, where most of its functionality is, is still largely a stub.HTMLTableSectionElement, HTMLTableRowElement, HTMLTableCellElement, HTMLTableDataCellElement, and HTMLTableHeaderCellElement were updated to the latest spec.HTMLIsIndexElement was removed; it has never been produced by the parser since 1.0.0-pre.1, and so it has been just a vestigial global property.HTMLMediaElement.Node.prototype.baseURI property to get the node's owner document's base URL.HTMLBaseElement's href getter now contains appropriate fallbacks and always returns an absolute URL, per spec.base elements in an "about:blank" iframe document, the base URL correctly falls back to the parent window's base URL.url: ... option to jsdom.jsdom() or jsdom.env(), the given string is now attempted to be resolved as a URL before it is installed as document.URL.
url: "http://example.com" will mean document.URL returns "http://example.com/", with a trailing slash.Added a full-featured, spec-compliant Element.prototype.classList, closing out a three-year old issue! (@wacii)
Element.prototype.classList, closing out a three-year old issue! (@wacii)virtualConsole.sendTo(console) forward "jsdomError"s to console by calling console.error. This can be turned off by doing virtualConsole.sendTo(console, { omitJsdomErrors: true }).<!DOCTYPE>."jsdomError"s that were emitted after calling window.close().DOMSubtreeModified event to fire in more cases. Note that our mutation events implementation remains incomplete, and will eventually be removed (in a major release) once we implement mutation observers. (@selam)Added basic implementations of HTMLMediaElement and HTMLVideoElement, back-ported from Facebook's Jest project. (@cpojer)
HTMLMediaElement and HTMLVideoElement, back-ported from Facebook's Jest project. (@cpojer)Fixed XMLHttpRequest.prototype.getAllResponseHeaders to not crash when used with file: URLs. (@justinmchase)
XMLHttpRequest.prototype.getAllResponseHeaders to not crash when used with file: URLs. (@justinmchase)XMLHttpRequest.prototype.response to correctly return the response text even when responseType was unset. (@justinmchase)This major release is focused on massive improvements in speed, URL parsing, and error handling. The potential breaking changes are highlighted in bol…
This major release is focused on massive improvements in speed, URL parsing, and error handling. The potential breaking changes are highlighted in bold below; the largest ones are around the jsdom.env error-handling paradigm.
This release also welcomes long-time contributer @Joris-van-der-Wel to the core team. You may recognize him from earlier changelogs. We're very happy to have his help in making jsdom awesome!
id and name attributes (including during parsing).node.compareDocumentPosition and anything that used it (like node.contains) by doing more intelligent tree traversal instead of directly implementing the specced algorithm.window.onerror (or window.addEventListener("error", ...)) now work, and will catch all script errors, similar to in browsers. This also introduces the ErrorEvent class, incidentally."jsdomError". This includes: errors loading external resources; script execution errors unhandled by window.onerror; and not-implemented warnings resulting from calling methods like window.alert which jsdom explicitly does not support.window.onerror and the virtual console, they are no longer included in the initialization process. This results in two changes to jsdom.env and the initialization lifecycle:
load(errors, window) callback was changed to onload(window), to reflect that it is now just sugar for setting a window.onload handler.done(errors, window) callback (i.e., the default callback for jsdom.env) has become done(error, window), and like every other io.js callback now simply gives you a single error object, instead of an array of them.errors array, or a raise method used to put things in that array.URL class has been added to windowHTMLAnchorElement.prototype and document.location (as well as URL, of course) are now uniformized to follow the URLUtils API (minus searchParams for now).file: URLs to jsdom.env where previously you were able to get away with passing in filenames.XMLHttpRequest.prototype.response getter.StyleSheetList.prototype.item to actually work. (@chad3814)vm shim to properly add the built-in global properties (Object, Array, etc.) to the sandbox. If you were running jsdom inside a web worker and most of your scripts were broken, this should fix that.hashchange event to correctly fire HashChangeEvent instances, with correct properties newURL and oldURL (instead of the incorrect newUrl and oldUrl used previously).eval and thus did not work in CSP scenarios.Finally, if you're a loyal jsdom fan whose made it this far into the changelog, I'd urge you to come join us in #1139, where we are brainstorming a modernized jsdom API that could get rid of many of the warts in the current one.
Fixed an accidentally-created global attribute variable if you ever called createAttributeNS.
attribute variable if you ever called createAttributeNS.url("quoted string") now works correctly, as of cssstyle v0.2.29.div[title=""], now work correctly, as of nwmatcher v1.3.6.virtualConsole.sendTo now returns this, allowing for a nice shorthand. (@jeffcarp)
virtualConsole.sendTo now returns this, allowing for a nice shorthand. (@jeffcarp)Added postMessage support, for communicating between parent windows, iframes, and combinations thereof. It's missing a few semantics, especially aroun
postMessage support, for communicating between parent windows, iframes, and combinations thereof. It's missing a few semantics, especially around origins, as well as MessageEvent source. Objects are not yet structured cloned, but instead passed by reference. But it's working, and awesome! (@jeffcarp)cloneNode and importNode), fixing a number of issues:
cloneNode method for now due to legacy).type property of <button> elements to correctly default to submit, and to stay within the allowed range.<button>s to submit their containing form; previously only <input type="submit"> worked. (@rxgx)document.open() to return this, per spec. (@ryanseddon)Additionally, Joris-van-der-Wel added a benchmarking framework, and a number of benchmarks, which should help us avoid performance regressions going forward, and also make targeted performance fixes. We're already investigating some real-world issues using this framework. Very exciting!
Incorporated upstream fix for setting el.style.cssText to an invalid value, which should be ignored instead of causing an error to be thrown. This sam
el.style.cssText to an invalid value, which should be ignored instead of causing an error to be thrown. This same bug has also caused an error while setting the style attribute to an invalid value, ever since 5.4.0. (Joris-van-der-Wel; chad3814 upstream)Fixed license metadata to conform to latest npm standards.
Fixed to work with browserify again (regression introduced in v5.4.0).
This is a pretty exciting release! It includes a couple features I never really anticipated jsdom being awesome enough to have, but our wonderful cont
This is a pretty exciting release! It includes a couple features I never really anticipated jsdom being awesome enough to have, but our wonderful contributors powered through and made them happen anyway:
window.getComputedStyle! (@akhaku)
show() and hide() methods now work correctly; see #994.window: any elements with an id attribute, or certain elements with a name attribute, will cause properties to show up on the window, and thus as global variables within the jsdom. (@Joris-van-der-Wel)
<iframe>s, and our implementation was quite buggy: e.g., <iframe name="addEventListener"> would override window.addEventListener.HTMLFormElements as well in the future.We also have a bunch more fixes and additions:
NonDocumentTypeChildNode mixin. Practically, this means adding nextElementSibling and previousElementSibling to Element and the various types of CharacterData. (@brandon-bethke-neudesic)StyleSheetList to inherit from Array, as per the latest CSSOM spec.NamedNodeMap implementation is up to date, as are the various Element methods; other places in the code that deal with attributes now all go through a spec-compliant set of helpers.style attribute were fixed along the way; see e.g. #1109.Attr objects themselves are not yet spec-compliant (e.g., they still inherit from Node). That's coming soon.getElementById would fail to work correctly on <img> elements whose id attributes were modified. (@Joris-van-der-Wel)virtualConsole option to work with jsdom.env, not just jsdom.jsdom. (@jeffcarp)window: mapper, mapDOMNodes, and visitTree. (@Joris-van-der-Wel)Added a virtualConsole option to the document creation methods, along with the jsdom.createVirtualConsole factory. (See examples in the readme.) With
virtualConsole option to the document creation methods, along with the jsdom.createVirtualConsole factory. (See examples in the readme.) With this option you can install a virtual console before the document is even created, thus allowing you to catch any virtual console events that occur during initialization. (@jeffcarp)Implemented much of the `ParentNode` mixin (Joris-van-der-Wel):
ParentNode mixin (Joris-van-der-Wel):
children from Node to ParentNode, i.e., made it available on Document, DocumentFragment, and Element, but not other types of nodes.children a HTMLCollection instead of a NodeList.firstElementChild, lastElementChild, and childElementCount.outerHTML setter. (@Joris-van-der-Wel)outerHTML getter for <select> and <form>. (@Joris-van-der-Wel)document.implementation.createHTMLDocument(). (@Joris-van-der-Wel)@import. (@dbo)Added support for the NodeIterator class from the DOM Standard. (@Joris-van-der-Wel)
NodeIterator class from the DOM Standard. (@Joris-van-der-Wel)Fixed document.cookie setter to no longer ignore null; instead it correctly sets a cookie of "null". (Chrome is not compliant to the spec in this rega
document.cookie setter to no longer ignore null; instead it correctly sets a cookie of "null". (Chrome is not compliant to the spec in this regard.)parsingMode: "xml" to no longer get "<html><head></head><body></body></html>" automatically inserted when calling jsdom.jsdom() with no arguments.innerHTML setter to no longer ignore undefined; instead it correctly sets the innerHTML to "undefined".document.write to throw for XML documents as per the spec.document.write to accept more than one argument (they get concatenated).document.write("") to no longer try to write "<html><head></head><body></body></html>".This release overhauls how cookies are handled in jsdom to be less fiddly and more like-a-browser. The work for this was done by @inikulin, who is als
This release overhauls how cookies are handled in jsdom to be less fiddly and more like-a-browser. The work for this was done by @inikulin, who is also our beloved parse5 maintainer.
You should only need to worry about upgrading to this release if you use jsdom's cookie handling capabilities beyond the basics of reading and writing to document.cookie. If that describes you, here's what changed:
options.jar and options.document.cookieDomain from the configuration for creating jsdom documents.options.cookieJar, which accepts cookie jars created by the new jsdom.createCookieJar() API. You should use this if you intend to share cookie jars among multiple jsdom documents.options.url when creating a document). This supplants the former options.document.cookieDomain.In addition to these changes to the public API, the following new cookie-related features came along for the ride:
<iframe>s. (So, if the iframe is same-domain, it can automatically access the appropriate cookies.)options.document.cookie accept arrays, instead of just strings, for if you want to set multiple cookies at once.Finally, it's worth noting that we now delegate our cookie handling in general to the tough-cookie package, which should hopefully mean that it now captures many of the behaviors that were previously missing (for example #1027). @inikulin is working on a large pull request to fix tough-cookie to be more spec compliant, which should automatically be picked up by jsdom installs once it is merged.
Nothing published for this version
Removed unnecessary browserify dependency that was erroneously included in 4.5.0.
Added document.currentScript. (@jeffcarp)
document.currentScript. (@jeffcarp)All resources are now loaded with the request package, which means that e.g. GZIPped resources will be properly uncompressed, redirects will be follow
jsdom.env, and not for sub-resources inside the resulting page. (@ssesha)Made the click behavior for radio buttons and checkboxes work when doing el.dispatchEvent(clickEvent), not just when doing el.click(). (@brandon-bethk
el.dispatchEvent(clickEvent), not just when doing el.click(). (@brandon-bethke-neudesic)defaultPrevented property to Event instances, reflecting whether ev.preventDefault() has been called. (@brandon-bethke-neudesic)click() method from HTMLInputElement.prototype to HTMLElement.prototype, per the latest spec.click() method trigger a MouseEvent instead of just an Event.Added a second parameter to UIEvent, MouseEvent, and MutationEvent, which for now just behaves the same as that for Event. (@Rich-Harris)
UIEvent, MouseEvent, and MutationEvent, which for now just behaves the same as that for Event. (@Rich-Harris)Added a second parameter to the Event constructor, which allows you to set the bubbles and cancelable properties. (@brandon-bethke-neudesic)
Event constructor, which allows you to set the bubbles and cancelable properties. (@brandon-bethke-neudesic)Added HTMLUnknownElement and fix the parser/document.createElement to create those instead of HTMLElement for unknown elements.
HTMLUnknownElement and fix the parser/document.createElement to create those instead of HTMLElement for unknown elements.window, as well as window.length, with regard to <frame>s/<iframe>s being added and removed from the document.Note: this probably should have been a minor version number increment (i.e. 4.1.0 instead of 4.0.5), since it added HTMLUnknownElement. We apologize for the deviation from semver.
Fixed parsing of doctypes by relying on the information provided by the html parser if possible.
Fixed events fired from EventTargets to execute their handlers in FIFO order, as per the spec.
EventTargets to execute their handlers in FIFO order, as per the spec.childNodes would not be correctly up to date in some cases. (@medikoo)jsdom.env by ~600%, for the special case when no scripts are to be executed.EventTarget is now correctly in the prototype chain of Window.
EventTarget is now correctly in the prototype chain of Window.EventTarget argument validation is now correct according to the DOM Standard.DOMException now behaves more like it should per Web IDL. In particular it has a more comprehensive set of constants, and instances now have name properties.new Event("click") can now be dispatched. (@lovebear)document.createEvent now behaves more like it should according to the DOM Standard: it accepts a wider range of arguments, but will throw if an invalid one is given. (@lovebear)Fixed: Node.prototype.contains to always return a boolean. This was a regression in 3.1.1. (@Joris-van-der-Wel)
Node.prototype.contains to always return a boolean. This was a regression in 3.1.1. (@Joris-van-der-Wel)Document.prototype no longer contains its own ownerDocument getter, instead correctly delegating to Node.prototype.<script>s in browserified jsdom.0 when setting numeric CSS properties and parsing of shorthand font declarations.<form> elements inside <template> elements.This release relies on the newly-overhauled vm module of io.js to eliminate the Contextify native module dependency. jsdom should now be much easier t
This release relies on the newly-overhauled vm module of io.js to eliminate the Contextify native module dependency. jsdom should now be much easier to use and install, without requiring a C++ compiler toolchain!
Note that as of this release, jsdom no longer works with Node.js™, and instead requires io.js. You are still welcome to install a release in the 3.x series if you are stuck on legacy technology like Node.js™.
In the process of rewriting parts of jsdom to use vm, a number of related fixes were made regarding the Window object:
Window instances—especially parser- and serializer-related state. This is no longer the case, thankfully.Window were updated for spec compliance: some data properties became accessors, and all methods moved from the prototype to the instance.document.parentWindow was removed, in favor of the standard document.defaultView. Our apologies for encouraging use of parentWindow in our README, tests, and examples.Some fixes to the NOT_IMPLEMENTED internal helper, which should eliminate the cases where calling e.g. window.alert crashes your application.
NOT_IMPLEMENTED internal helper, which should eliminate the cases where calling e.g. window.alert crashes your application.NOT_IMPLEMENTED methods, like window.location.reload.about:blank properly on all systems (previously it only worked on Windows). This is especially important since as of 3.0.0 the default URL is about:blank.<script>s inside a browserified jsdom instance. This is done by dynamically rewriting the source code so that global variable references become explicit references to window.variableName, so it is not foolproof.Updated Node.prototype.isEqualNode to the algorithm of the DOM Standard, fixing a bug where it would throw an error along the way.
Node.prototype.isEqualNode to the algorithm of the DOM Standard, fixing a bug where it would throw an error along the way.Node.prototype.isSameNode, which is not present in the DOM Standard (and was just a verbose === check anyway).jsdom.env. However, while doing so discovered that <script>s in general don't work too well in a browserified jsdom; see #1023.Added support for custom external resource loading. (@tobie)
Fixed some stray byte-order marks in a couple files, which incidentally break Browserify. (@sterpe)
Fixed another edge case where unchecking a radio button would incorrectly uncheck radio buttons outside the containing form. (@zpao)
Fixed errors when serializing text nodes (possibly only occurred when inside ).
<template>).jsdom.env's autodetecting capabilities. (@fluffybunnies)jsdom.env's html option. (@fluffybunnies)This release updates large swathes of the DOM APIs to conform to the standard, mostly by removing old stuff. It also fixes a few bugs, introduces a co
This release updates large swathes of the DOM APIs to conform to the standard, mostly by removing old stuff. It also fixes a few bugs, introduces a couple new features, and changes some defaults.
3.0.x will be the last release of jsdom to support Node.js. All future releases (starting with 4.0.0) will require io.js, whose new vm module will allow us to remove our contextify native-module dependency. (Given that I submitted the relevant patch to joyent/node 1.5 years ago, I'm very excited that we can finally use it!)
about:blank as their URL, instead of trying to infer some type of file URL from the call site (in Node.js) or using location.href (in browsers).console.error will no longer contribute to the (non-standard, and likely dying in the future) window.errors array. (@jeffcarp)new Image(width, height) constructor. (@vinothkr)querySelector with selectors like div:last-child > span[title].DOMImplementation to mostly work per-spec, including removing addFeature and removeFeature methods, the ownerDocument property, and making hasFeature always return true.CharacterData implementation to follow the algorithms in the DOM Standard; this notably removes a few exceptions that were previously thrown.Comment, Text, and ProcessingInstruction to follow the DOM Standard and derive from CharacterData.DocumentType to follow the DOM Standard and be much simpler, notably removing notations, entities, and default attributes.Node, Element, Attr, and Document; some were removed that were nonstandard (especially setters); others were updated to reflect the spec; etc.document.contentType now is generally inferred from the parsing mode of the document.Document.prototype and Window.prototype instead of setting them as own properties during the document/window creation. This should improve memory usage (as well as spec compliance).This release is largely a refactoring release to remove the defunct concept of "levels" from jsdom, in favor of the living standard model that browser
This release is largely a refactoring release to remove the defunct concept of "levels" from jsdom, in favor of the living standard model that browsers follow. Although the code is still organized that way, that's now noted as a historical artifact. The public API changes while doing so were fairly minimal, but this sets the stage for a cleaner jsdom code structure going forward.
jsdom.level, and the level option from jsdom.jsdom.Element.prototype.matchesSelector method was replaced with the standard Element.prototype.matches. (@KenPowers)querySelector correctly coerces its argument to a string (1.2.2 previously fixed this for querySelectorAll).Your coding agent can read these notes before it upgrades. Set up the MCP server →