Skip to content

Changes from 0.11.1 to 1.0.0

domenic edited this page Sep 28, 2014 · 1 revision

jsdom finally got its 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. It also evolved over a series of seven prereleases, so the usual changelog can be a bit confusing to get a consolidated picture from.

Starting with the 1.0.0 release, we will be following semantic versioning, so that you can depend on stability within major version ranges.

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 have a new parsingMode configuration, which allows you to manually specify XML or HTML parsing modes. (As such, jsdom will no longer use the presence of <?xml or similar to attempt to auto-detect XHTML documents.) Note that our XHTML support is still very crude, and we will never be a general-purpose XML DOM; see #885 for more details. (Sebmaster)

Removed jsdom APIs

  • jsdom.createWindow: use document.parentWindow after creating a document
  • jsdom.html: use jsdom.jsdom
  • jsdom.version: use require("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

Removed non-standard DOM APIs

  • document.createWindow: use document.parentWindow
  • document.outerHTML: use the new jsdom.serializeDocument to include the DOCTYPE, or use document.documentElement.outerHTML to omit it
  • document.innerHTML: use document.documentElement.innerHTML or document.write
  • EventTarget.getListeners, EventTarget.forwardIterator, EventTarget.backwardIterator, and EventTarget.singleIterator: most of these were useless, but if you need a counterpart to getListeners, file an issue and we'll add jsdom.getEventTargetListeners or something

Other fixes

  • Same-named radio inputs should not be mutually exclusive unless they are in the same form. (stof)
  • The value and defaultValue properties of a HTMLInputElement are now correctly synced to the value="" attribute. (Sebmaster)
  • Make event listeners in the capture phase also fire on the event target. (Joris-van-der-Wel)
  • Correctly reset eventPhase and currentTarget on events, before and after a dispatch. (Joris-van-der-Wel)
  • Attributes and elements now have their prefix, localName, and namespaceURI properties set correctly in all cases, at least in the HTML parsing mode. (Sebmaster)
  • Fix document.cookie = null to not throw, but instead just do nothing. (kapouer)
  • Allow empty strings to be passed to jsdom.env. (michaelmior)
  • Fix for a memory leak in EventTarget.prototype.dispatchEvent. (Joris-van-der-Wel)
  • Fix window.close() to avoid the occassional segfault.
  • Memoized various DOM-querying functions (e.g. getElementsByTagName, querySelector, etc.) to improve performance. (ccarpita)