UNPKG

react-saasify-chrisvxd

Version:

React components for Saasify web clients.

631 lines (485 loc) 128 kB
<!-- Style guide: * Use past tense verbs to start the sentence, e.g. "Fixed", "Added", "Removed", ... * Each bullet point is a sentence (or more), and so ends with a period. * Package names are in `code`, sometimes [`linked`](). * Prefer referring to methods and properties via `someInstance.prop`, instead of `ClassName.prototype.prop`. (Never use `ClassName.prop` except for statics.) * Refer to attributes via `attr=""`. * Refer to elements via `<element>`. * Refer to events via `eventname`. * Never use the IDL terms "interface", "attribute", or "operation". * URL schemes are in `code`, e.g. `data:`. * Except in the headings, all version numbers get a "v" prefix, e.g. v12.2.0. * Follow the bullet point with parenthetical GitHub usernames when contributed by a non-core team member, e.g. "Fixed foo. (person)" Other guidelines: * Commit messages are primarily for jsdom developers. Changelog entries are primarily for users. Usually you cannot reuse the commit message. * Sometimes a single commit may expand to multiple changelog entries. * Do not include commits that have no user-facing impact, e.g. test rolls, refactorings, benchmark additions, etc. * For regression fixes, note the version in which something regressed. * Breaking changes get their own section. * Group in the order "Added", "Removed", "Changed", "Fixed". * Roughly order changes within those groupings by impact. --> ## 14.1.0 * Added activation behavior for `<a>` and `<area>` elements whose `href=""` points to a `javascript:` URL or fragment. * Added the `<datalist>` element's `options` property. * Added the `<input>` element's `list` property. * Added `PageTransitionEvent`, and the firing of `pageshow` events during loading. * Exposed the `External` class as a property of `window`. * Fixed HTML fragment parsing (via `innerHTML` and `outerHTML`) to be spec-compliant. (pmdartus) * Fixed HTML serialization (e.g. via `innerHTML`) breaking after setting certain properties to non-string values. * Fixed how disabling an element would cause its activation behavior to forever be null, even if it were re-enabled. * Fixed all access to attributes to ignore attributes with namespaces, per the spec. * Fixed `<style>`s to no longer apply to documents without a browsing context. This includes fixing a crash that would occur with such styles if they had an `@import` rule. * Fixed `<option>`'s `label` and `value` properties to return correct values in various edge cases. * Fixed the `load` event during document loading to target the `Document`, not the `Window`. * Fixed the `pretendToBeVisual` option to propagate to child subframes, as well as the main `Window`. (pyrho) * Updated the minimum [`nwsapi`](https://www.npmjs.com/package/nwsapi) version from v2.1.1 to v2.1.3, bringing along a few fixes in our selector engine. ## 14.0.0 Breaking changes: * `JSDOM.fragment()` now creates fragments whose document has no [browsing context](https://html.spec.whatwg.org/multipage/#concept-document-bc), i.e. no associated `Window`. This means the `defaultView` property will be null, resources will not load, etc. * `JSDOM.fragment()`, called with no arguments, now creates a `DocumentFragment` with no children, instead of with a single child text node whose data was `"undefined"`. Other changes: * Fixed a regression in v13.2.0 when calling `element.blur()` on a focused element. * Fixed inserting `<link>` elements into documents with no browsing context to no longer crash if the originating `JSDOM` was configured to fetch the resource. Now, per spec, `<link>` elements only attempt to fetch if they are browsing-context connected. * Fixed `<template>` elements to have the correct semantics, of using a separate browsing-context-less document to store its contents. In particular this means resources will not be fetched for elements inside the `<template>`, as per spec. ## 13.2.0 * Added support for `MutationObserver`s! (pmdartus) * Added support for XML documents loaded in frames and iframes; previously this would error. * Added the `<progress>` element's `value`, `max`, and `position` properties. * Added `navigator.plugins` and `navigator.mimeTypes`. (But, they are always empty.) * Fixed `<summary>` elements respond to `click` events by toggling their parent `<details>`. * Fixed `<summary>` elements to be focusable. * Fixed XML document DOCTYPE parsing to preserve any custom name values. * Fixed XML documents to default to UTF-8, not windows-1252 like HTML documents do. * Fixed all events fired by jsdom to have `isTrusted` set to `true`. * Fixed `DOMParser`-created documents to have their `readyState` set to `"complete"`. * Fixed how nested `<fieldset>`s get disabled. * Fixed `getComputedStyle()` to throw a sensible exception when passed the wrong argument, instead of one that exposes jsdom internals. * Upgraded our [`saxes`](https://github.com/lddubeau/saxes) dependency, so that it now correctly errors on XML fragments like `<foo bar:="1"/>`. ## 13.1.0 * Added `el.insertAdjacentElement()` and `el.insertAdjacentText()`. * Added the firing of a cancelable `reset` event to `form.reset()`. (epfremmer) * Added the `type`, `value`, and `defaultValue` properties to `<output>` elements, including their form reset behavior. (epfremmer) * Added the `outputEl.htmlFor` property. * Fixed the performance of parsing large text nodes, particularly noticeable for large inline `<style>` or `<script>` elements. This regressed in v11.6.0. To learn more, see [V8 issue #6730](https://bugs.chromium.org/p/v8/issues/detail?id=6730#c4). * Fixed the `style` property on `<a>` and `<area>` elements. This regressed in v13.0.0. * Fixed `node.isConnected` to not always return false for nodes inside a shadow tree. (pmdartus) * Fixed `<button type="reset">` and `<input type="reset">` elements to actually perform a form reset when clicked, instead of doing nothing. (epfremmer) * Fixed `el.setCustomValidity()` for `<output>` and `<fieldset>`. * Fixed activation behavior when dispatching bubbling `click` events, so that for example calling `el.click()` on the child of a submit button element will submit the form. * Fixed our XML parsing code to ignore text outside the root element, instead of treating it as an error. (lddubeau) * Fixed XML serialization when elements had an unknown prefix. * Fixed radio button group name matching to be case-sensitive, per [a spec update](https://github.com/whatwg/html/commit/6acdb2122298d2bb7bb839c0a61b4e1f9b0f9bc9). * Fixed `focus`/`blur` events to be composed. * Fixed `mediaElement.duration` to default to `NaN`. * Fixed `olEl.start` to default to `1`. * Fixed using `XMLHttpRequest` against non-existant `file:` URLs to treat that as a network error, instead of crashing. (pascalbayer) Note that in the future we may completely disable `XMLHttpRequest` usage against `file:` URLs to follow the browser security model. * Fixed `document.title` in SVG documents. * Fixed `titleElement.text` to return the child text content, instead of being the same as `titleElement.innerHTML`. * Fixed `<textarea>`s to properly account for child CDATA section nodes changing. * Fixed the value of `Element.prototype[Symbol.unscopables]`. ## 13.0.0 Breaking change: * Removed support for v1.x of the [`canvas`](https://github.com/Automattic/node-canvas) package, in favor of v2.x. This also removes support for `canvas-prebuilt`, since `canvas` v2.x has a built-in prebuilt version. Other changes: * Added proper XML serialization, based on the [`w3c-xmlserializer`](https://github.com/jsdom/w3c-xmlserializer) package. Previously we were just using the HTML serialization, even in XML documents. * Added the `storageEvent.initStorageEvent()` method. * Added support for the `passive` option to `addEventListener()`. * Added the `relList` property to `<a>`, `<area>`, and `<link>` elements. * Fixed our implementation of the node tree modification constraints (for example the [ensure pre-insertion validity](https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validity) algorithm). It is no longer possible to add, remove, or move nodes to create impossible DOM trees. (pmdartus) ## 12.2.0 * Added support for shadow DOM! This includes shadow roots, slots, composed events, and more. (pmdartus) * Added the `element.toggleAttribute()` method. * Fixed `XMLHttpRequest` sometimes sending an empty request body after a preflight request. (andreasf) * Fixed the `formElement.form` property to use an algorithm that also checks the `form=""` attribute, instead of always looking for the closest ancestor `<form>` element. (jamietre) * Stopped swallowing errors when the `canvas` or `canvas-prebuilt` packages were installed, but failed to load. (joscha) ## 12.1.0 * Dramatically upgraded our XML parser, from the unmaintained [`sax`](https://github.com/isaacs/sax-js) package to the well-maintained [`saxes`](https://github.com/lddubeau/saxes) replacement. This increases our specification conformance, including rejecting certain ill-formed XML documents that were previously accepted, and properly handling other constructs like empty comments, CDATA sections, and `<script>` elements. (lddubeau) * Added `fieldsetEl.elements` and `fieldsetEl.type` properties. * Added the `options` parameter to `dom.runVMScript()`. (SimenB) * Added the ability for custom resource loader `fetch()` implementations to see what element initiated the fetch. (sarvaje) * Fixed `input` and `change` events for `<input>` elements to be trusted and uncancelable. * "Fixed" `<script>`s with the `async` attribute to not execute before sync `<script>`s that precede them. We still do not, in general, have proper execution of scripts during the initial parsing of a document, so this fix is more of a reduction of badness than an alignment with the specification. This behavior regressed in v12.0.0. (sarvaje) ## 12.0.0 This major release brings along our [new resource loader API](https://github.com/jsdom/jsdom#loading-subresources), finally bringing all the capabilities from jsdom v9 to the new (jsdom v10+) API. Thanks very much to [@sarvaje](https://github.com/sarvaje) for his work to make this possible! Breaking changes: * jsdom now requires Node.js v8. * Removed the old jsdom API, as the new API now has all the capabilities you need. * Updated our [`parse5`](https://github.com/inikulin/parse5/) dependency to v5, which changes the format of the node locations returned by `dom.nodeLocation()`. * Updated our [`whatwg-url`](https://github.com/jsdom/whatwg-url) dependency to v7, which changes the origin of `file:` URLs to be an opaque origin (and thus `file:` URLs are no longer same origin to each other). Other changes: * Added `countReset()`, `dir()` and `dirxml()` methods to `console`. * Added the `InputEvent` class. * Added `window.status`. * Added `htmlElement.draggable`. * Fixed `window.frameElement` to correctly return an actual `HTMLElement` instance, instead of a jsdom internal class. * Fixed cloning of `textarea` elements to preserve their values. * Fixed `select.selectedOptions` sometimes returning outdated results. * Fixed CSS selection APIs sometimes returning outdated results, especially for state pseudo-class selectors like `:checked`. * Fixed CSS selection APIs to throw an error for invalid selectors even when used on empty nodes. * Fixed `window.name` to default to the empty string, per spec, instead of `"nodejs"`. * Fixed the default User-Agent to say "unknown OS" instead of "undefined" when jsdom is used in web browsers. ## 11.12.0 * Added `window.localStorage`, `window.sessionStorage`, and `StorageEvent` support. These are currently only stored in-memory; file an issue if you need persistent (on-disk) storage capability so we can discuss adding that. This feature includes the new `storageQuota` option for controlling how much can be stored. * Added `element.closest()`. (caub) * Changed `hashchange` and `popstate` events to no longer bubble, per a specification update. * Fixed the old API in Node.js v10 to not throw, when given input that is not a valid file path (such as a typical HTML string). * Upgraded `cssstyle` to v1.0.0, bringing along various fixes to our CSS parser and object model. (eddies) * Upgraded `nwsapi` to v2.0.7, bringing along various fixes to our selector engine. ## 11.11.0 * Added `node.getRootNode()`. (FrecksterGIT) * Added `label.control`. (FrecksterGIT) * Added `el.labels` for form control elements. (FrecksterGIT) * Fixed the `contentType` of `Document`s created through `<iframe>`s. * Fixed the `contentType` and `origin` of `Document`s created through `document.implementation.createDocument()`. * Fixed `sourceEl.srcset` to return the value of the `srcset=""` attribute, instead of the `cite=""` attribute. * Fixed `node.normalize()` to not modify non-`Text` nodes. (lddubeau) * Upgraded `cssstyle` to v0.3.1, bringing along various fixes to our CSS parser and object model. (jsakas) * Upgraded `whatwg-url` to v6.4.1, fixing the interaction of `URL`'s `href` and `searchParams` properties. * Upgraded our selector matching engine from `nwsmatcher` to `nwsapi`, bringing along extensive fixes, performance improvements, and additional selector support. ## 11.10.0 * Added `event.srcElement` and `event.returnValue`. * Fixed `XMLHttpRequest` to correctly set the User-Agent header, and set it on CORS preflight requests. (BehindTheMath) ## 11.9.0 * Added `node.lookupPrefix()`, `node.lookupNamespaceURI()` and `node.isDefaultNamespace()`. * Fixed the cloning of `Document`s; previously it would not clone all of the appropriate state, and would sometimes add an extra document type node. * Fixed various edge cases in the `textContent` and `nodeValue` properties. * Fixed `canvas.toBlob()` to properly pass through the JPEG quality argument, instead of always passing zero to `node-canvas`. (challakoushik) ## 11.8.0 * Added the full constraint validation API, i.e. `willValidate`, `validity`, `validationMessage`, `checkValidity()`, `reportValidity()`, and `setCustomValidity()`, on `HTMLButtonElement`, `HTMLFieldSetElement`, `HTMLFormElement`, `HTMLInputElement`, `HTMLObjectElement`, `HTMLOutputElement`, `HTMLSelectElement`, and `HTMLTextAreaElement`. (kontomondo) * Added `getElementById()` to `DocumentFragment`. ## 11.7.0 * Added the boolean return value to `DOMTokenList`'s `replace()` method, per the recent spec addition. * Added `FileReader`'s `readAsBinaryString()` method, as it has been added back to the specification. * Fixed event handlers to be own properties of each `Window`, instead of on `Window.prototype`. (Fetz) * Fixed an exception that would sometimes get raised when removing an `<img>` element's `src=""` attribute. (atsikov) * Fixed `abort` events on `AbortSignal`s to have their `isTrusted` set to true. * Fixed some argument conversions in `XMLHttpRequest`'s `open()` method. * Improved MIME type and `data:` URL parsing throughout jsdom, by using the new [`whatwg-mimetype`](https://www.npmjs.com/package/whatwg-mimetype) and [`data-urls`](https://www.npmjs.com/package/data-urls) packages. * Removed some unnecessary `.webidl` files that were included in the npm package. ## 11.6.2 * Fixed another regression (since v11.6.0) in `<style>` elements, where they would omit a series of parsing `jsdomError` events for any style sheet text containing spaces. * Generally improved the spec-conformance of when `<style>` and `<script>` elements are evaluated; for example, `<script>` elements inserted by `innerHTML` are no longer evaluated. ## 11.6.1 * Fixed one regression (since v11.6.0) in `<style>` elements, where their `sheet` property would sometimes be `null` when it should not be. * Fixed a case where a `<style>` element's `sheet` property would be left as a `CSSStyleSheet` despite it not being in the document. Another regression remains where we are emitting spurious CSS-parsing `jsdomError` events; see [#2123](https://github.com/tmpvar/jsdom/issues/2123). We also discovered a large amount of preexisting brokenness around `<style>`, `<link>`, and `@import`; see [#2124](https://github.com/tmpvar/jsdom/issues/2124) for more details. We'll try to fix these soon, especially the regression. ## 11.6.0 * Added a fully-functioning `WebSocket` implementation! * Added a `window.performance` implementation, including the basics of the [High Resolution Time](https://w3c.github.io/hr-time/) specification: `performance.now()`, `performance.timeOrigin`, and `performance.toJSON()`. * Added support for all of the public API of `HTMLMeterElement`, except for `meterEl.labels`. * Added the `locationbar`, `menubar`, `personalbar`, `scrollbars`, `statusbar`, and `toolbar` properties to `Window`. * Added more properties to `window.screen`: `availWidth`, `availHeight`, `colorDepth`, and `pixelDepth`. All of its properties are now getters as well. * Added `window.devicePixelRatio`. * Added `getModifierState()` to `MouseEvent` and `KeyboardEvent`. * Added a setter for `HTMLInputElement`'s `files` property. * Added support for the `endings` option to the `Blob` constructor. * Fixed firing various event firings to have the correct default values, e.g. the properties of `MouseEvent` when using `element.click()`. * Fixed the firing of `popstate` and `hashchange` events during fragment navigation to make them trusted events. * Fixed `data:` URL parsing to not include the fragment portions. * Fixed all URL-accepting properties to properly perform [scalar value string conversion](https://infra.spec.whatwg.org/#javascript-string-convert) and URL resolution. * Fixed many other small edge-case conformance issues in the API surface of various web APIs; see [#2053](https://github.com/tmpvar/jsdom/pull/2053) and [#2081](https://github.com/tmpvar/jsdom/pull/2081) for more information. * Fixed various APIs to use ASCII lowercasing, instead of Unicode lowercasing, for element and attribute names. * Fixed the encoding of a document created via `new Document()` to be UTF-8. * Fixed event handler properties behavior when given non-callable objects. * Increased the performance of parsing HTML documents with large numbers of sibling elements. * Removed `probablySupportsContext()` and `setContext()` from `HTMLCanvasElement`, per spec updates. * Removed the nonstandard `window.scrollLeft` and `window.scrollTop` properties, and the `window.createPopup()` method. ## 11.5.1 (This should have been a minor release; oops.) * Added `AbortSignal` and `AbortController`. * Fixed validation for file `<input>`s and implemented validation for more input types. ## 11.4.0 For this release we'd like to welcome [@Zirro](https://github.com/tmpvar/jsdom/commits?author=Zirro) to the core team; his contributions over the course of this year have enhanced jsdom immensely. * Added a rudimentary set of SVG element classes, namely `SVGElement`, `SVGGraphicsElement`, `SVGSVGElement`, `SVGTests`, `SVGAnimatedString`, `SVGNumber`, and `SVGStringList`. The main impact here is that SVG elements are now instances of `SVGElement`, instead of being simply `Element` (as they were in v11.3.0) or `HTMLUnknownElement` (as they were in v11.2.0 and previously). The only concrete subclass that is implemented is `SVGSVGElement`, for `<svg>` itself; other tags will not map to their correct classes, because those classes are not yet implemented. * Added the new `pretendToBeVisual` option, which controls the presence of the new `requestAnimationFrame()` and `cancelAnimationFrame()` methods, and the new values of `document.hidden`/`document.visibilityState`. [See the README](https://github.com/tmpvar/jsdom#pretending-to-be-a-visual-browser) for more information. (SimenB) * Added the `append()` and `prepend()` methods to `Document`, `DocumentFragment`, and `Element`. (caub) * Added the `before()`, `after()`, and `replaceWith()` methods to `DocumentType`, `Element`, and `CharacterData`. (caub) * Added `node.isConnected`. * Added `node.isSameNode()`. * Added support for parsing CDATA sections in XML documents, including in `domParser.parseFromString()`. (myabc) * Added appropriate `input.value` getter/setter logic for `<input type="file">`. * Significantly improved the spec-compliance of `NamedNodeMap`, i.e. of `element.attributes`, such that retrieving named or indexed properties will now always work properly. * Fixed `domParser.parseFromString()` to not parse HTML character entities in XML documents. (myabc) * Fixed `xhr.abort()` to clear any set headers. * Fixed `XMLHttpRequest` to always decoded responses as UTF-8 when `responseType` is set to `"json"`. * Fixed `XMLHttpRequest` CORS header handling, especially with regard to preflights and Access-Control-Allow-Headers. (ScottAlbertine) * Fixed the behavior of `radioButton.click()` to fire appropriate `input` and `change` events. (liqwid) * Fixed `querySelector()`/`querySelectorAll()` behavior for SVG elements inside `<template>` contents `DocumentFragment`s, including those created by `JSDOM.fragment()`. (caub) * Fixed the line number reporting in exception stack traces when using `<script>` elements, when `includeNodeLocations` is set. * Removed the `<applet>` element, [following the spec](https://github.com/whatwg/html/pull/1399). ## 11.3.0 For this release we'd like to formally welcome [@TimothyGu](https://github.com/tmpvar/jsdom/commits?author=TimothyGu) to the core team, as a prolific contributor. He will join the illustrious ranks of those who do so much work on jsdom that we no longer note their names in the changelog. * Added `table.tHead`, `table.tFoot`, and `table.caption` setters, and the `table.createTBody()` method. * Added `CompositionEvent` and `WheelEvent` classes. * Added a `<details>` element implementation. (Zirro) * Added stub `<marquee>` and `<picture>` element implementations. (Zirro) * Updated `uiEvent.initUIEvent()`, `keyboardEvent.initKeyboardEvent()`, and `mouseEvent.initiMouseEvent()` to match the latest specifications. * Converted `DOMTokenList` (used by, e.g., `element.classList`) to use proxies for improved specification compliance and "liveness". * Fixed the `DOMException` class to be spec-compliant, including its constructor signature. * Fixed some subtle interactions between inline event handlers and other event listeners. * Fixed the element interface used when creating many of the more obscure elements. * Fixed the behavior of the `table.rows` getter, and the `table.createCaption()` and `table.deleteRow()` methods. * Fixed incorrect sharing of methods between interfaces that used mixins (e.g. previously `document.querySelector === documentFragment.querySelector`, incorrectly). * Fixed `FocusEvent` creation, which regressed in v11.2.0. * Fixed `UIEvent` to only allow initializing with `Window` objects for its `view` property. * Fixed the behavior of `tr.rowIndex` and `tr.deleteCall()`. * Fixed the element interface for `<td>` and `<th>` to be simply `HTMLTableCellElement`, and improved that class's spec compliance. * Fixed calling `label.click()` to not trigger the labeled control's activation behavior when the control is disabled. (schreifels) * Fixed `document.getElementsByName()` to return a `NodeList` instead of a `HTMLCollection`. (Zirro) * Significantly sped up synchronous `XMLHttpRequest`. (Zirro) ## 11.2.0 This release brings with it a much-awaited infrastructure change, as part of [webidl2js v7.3.0](https://github.com/jsdom/webidl2js/releases/tag/v7.3.0) by the ever-amazing TimothyGu: jsdom can now generate spec-compliant versions of classes that have "`Proxy`-like" behavior, i.e. allow getting or setting keys in unusual ways. This enables a number of improvements, also by TimothyGu: * Significantly improved the spec-compliance and "liveness" of both `NodeList` and `HTMLCollection`, such that retrieving properties via indices or (in `HTMLCollection`'s case) `id`/`name` values will always work correctly. * Added `element.dataset` support. * Added indexed and named access to `<select>` elements, as well as the corresponding `item()` and `namedItem()` methods. * Added suport for `FileList` indexed properties, i.e. `fileList[i]`. * Made `select.options` an instance of the newly-implemented `HTMLOptionsCollection`, instead of just a `HTMLCollection`. This infrastructure will allow us to improve and implement many other similar behaviors; that work is being tracked in [#1129](https://github.com/tmpvar/jsdom/issues/1129). In addition to these improvements to the object model, we have more work to share: * Added no-op APIs `document.clear()`, `document.captureEvents()`, `document.releaseEvents()`, `window.external.AddSearchProvider()`, and `window.external.IsSearchProviderInstalled()`. (Zirro) * Added active checks to prevent reentrancy in `TreeWalker` and `NodeIterator`. * Updated the interaction between a `<textarea>`'s `value`, `defaultValue`, and `textContent` per [a recent spec change](https://github.com/whatwg/html/commit/5afbba1cf62ee01bc6af3fd220d01f3f7591a0fc) * Fixed elements with `id="undefined"` shadowing the `undefined` property of the global object. (TimothyGu) * Fixed matching in `getElementsByClassName()` to be ASCII case-insensitive, instead of using JavaScript's `toLowerCase()`. * Improved some behaviors around navigating to fragments. (ForbesLindesay) * Improved `XMLHttpRequest` and `FileReader` behavior, mainly around event handlers, `abort()`, and network errors. * Improved edge-case spec compliance of `NodeIterator`. ## 11.1.0 * Added `javascript:` URL "navigation" via `window.location`, at least by evaluating the side effects. It still doesn't actually navigate anywhere. (ForbesLindesay) * Updated `whatwg-url` to v6.1.0, bringing along origin serialization changes and `URLSearchParams` among various other fixes. (ForbesLindesay) * Fixed `javascript:` URL loading for iframes to do proper percent-decoding and error reporting. * Fixed corrupted `XMLHttpRequest` responses when they were over 1 MiB. * Fixed timers to not start after a window is `close()`d, which could cause strange errors since most objects are unusable at that point. (Enverbalalic) ## 11.0.0 Breaking changes: * Custom parsers, via the `parser` option to the old API, can no longer be specified. They were never tested, often broken, and a maintenance burden. The defaults, of [parse5](https://www.npmjs.com/package/parse5) for HTML and [sax](https://www.npmjs.com/package/sax) for XML, now always apply. * Due to a parse5 upgrade, the location info objects returned by `dom.nodeLocation()` or the old API's `jsdom.nodeLocation()` now have a different structure. * Fixed how `runScripts` applies to event handler attributes; now they will no longer be converted into event handler functions unless `runScripts: "dangerously"` is set. However, event handler _properties_ will now work with any `runScripts` option value, instead of being blocked. Other changes: * Overhauled how event handler properties and attributes work to follow the spec. In particular, this adds various `oneventname` properties to various prototypes, ensures the correct order when interleaving event handlers and other event listeners, and ensures that event handlers are evaluated with the correct values in scope. * Upgraded parse5 from v1 to v3, bringing along several correctness improvements to HTML parsing. (Zirro) * Updated `Location` properties to be on the instance, instead of the prototype, and to be non-configurable. * Significantly improved the performance of `HTMLCollection`, and thus of parsing large documents. (Zirro) * Significantly improved the performance of `getComputedStyle()` by removing unsupported selectors from the default style sheet. (flaviut) * Fixed all web platform methods that accepted web platform objects to perform proper type checks on them, throwing a `TypeError` when given invalid values. (TimothyGu) * Fixed the `Symbol.toStringTag` properties to be non-writable and non-enumerable. (TimothyGu) * Fixed `tokenList.remove()` when the `DOMTokenList` corresponded to a non-existant attribute. (Zirro) * Fixed `fileReader.abort()` to terminate ongoing reads properly. * Fixed `xhr.send()` to support array buffer views, not just `ArrayBuffer`s. (ondras) * Fixed non-`GET` requests to `data:` URLs using `XMLHttpRequest`. (Zirro) * Fixed form submission to no longer happen for disconnected forms. * Fixed body event handler attributes to be treated like all others in terms of how they interact with `runScripts`. * Many updates per recent spec changes: (Zirro) * Updated `tokenList.replace()` edge-case behavior. * Invalid qualified names now throw `"InvalidCharacterError"` `DOMException`s, instead of `"NamespaceError"` `DOMException`s. * Changed `input.select()` to no longer throw on types where selection does not apply. * Updated `event.initEvent()` and various related methods to have additional defaults. * Stopped lowercasing headers in `XMLHttpRequest` responses. * Started lowercasing headers in `xhr.getAllResponseHeaders()`, and separating the header values with a comma-space (not just a comma). * Allow a redirect after a CORS preflight when using `XMLHttpRequest`. * Tweaked username/password CORS treatment when using `XMLHttpRequest`. * Changed `xhr.overrideMimeType()` to no longer throw for invalid input. * Removed `blob.close()` and `blob.isClosed()`. * Removed some remaining not-per-spec `toString()` methods on various prototypes, which were made redundant in v10.1.0 but we forgot to remove. ## 10.1.0 * Added the value sanitization algorithm for password, search, tel, text, color, email, and url input types. (Zirro) * Added `Symbol.toStringTag` to all web platform classes, so that now `Object.prototype.toString.call()` works as expected on jsdom objects. * Added the `select.selectedOptions` property. * Removed the `toString()` methods on various prototypes that returned `"[object ClassName]"` in an attempt to fake the `Symbol.toStringTag` behavior. * Changed `XMLHttpRequest` to pre-allocate a 1 MiB buffer, which it grows exponentially as needed, in order to avoid frequent buffer allocation and concatenation. (skygon) * Fixed a variety of properties that were meant to always return the same object, to actually do so. (Zirro) * Fixed inheritance of the `runScripts` and `resources` options into iframes. * Fixed an uncaught exception that occurred if you called `xhr.abort()` during a `readystatechange` event. ## 10.0.0 This release includes a complete overhaul of jsdom's API for creating and manipulating jsdoms. The new API is meant to be much more intuitive and have better defaults, with complete documentation in the newly-overhauled README. We hope you like it! As discussed in the new README, the old API is still available and supported via `require("jsdom/lib/old-api.js")`, at least until we have ported all of its features over to the new API. It will, however, not be gaining any new features, and we suggest you try the new API unless you really need the customizable resource loading the old API provides. Apart from the new API, the following changes were made, with breaking changes bolded: * **Removed support for Node.js v4 and v5**, as we have started using new JavaScript features only supported in Node.js v6 onwards. * **Changed the `omitJsdomErrors` option to `omitJSDOMErrors`**, for consistency [with web platform APIs](https://w3ctag.github.io/design-principles/#casing-rules). * Added `document.dir`. (Zirro) * Updated the `<a>` and `<area>` APIs to the latest specification, and fixed a few bugs with them. (makana) * Fixed `<img>` elements to no longer fire `load` events unless their image data is actually loaded (which generally only occurs when the `canvas` package is installed). * Fixed `XMLHttpRequest` preflights to forward approved preflight headers to the actual request. (mbroadst) * Fixed `htmlElement.dir` to properly restrict its values to `"ltr"`, `"rtl"`, or `"auto"`. (Zirro) * Fixed setting `innerHTML` to the empty string to no longer be a no-op. (Zirro) * Fixed the origin-checking logic in `window.postMessage()`, so that now you don't always have to pass an origin of `"*"`. (jmlopez-rod) * Improved the `xhr.open()` error message when there are not enough arguments. (lencioni) ## 9.12.0 * Added the `Option` named constructor. (NAlexPear) * Added support for the `canvas-prebuilt` npm package as an alternative to `canvas`. (asturur) * Fixed `setTimeout()` and `setInterval()` to always return a positive integer, instead of returning `0` the first time were called. (yefremov) * Fixed `jsdom.env()` to preserve URL fragments across redirects. (josephfrazier) * Fixed `optionEl.text` and `optionEl.value` to be more spec-compliant. * Fixed `event.stopImmediatePropagation()` to actually stop immediate propagation, not just propagation. * Fixed `clearTimeout()` and `clearInterval()` to work correctly when using jsdom browserified. ## 9.11.0 * Added dummy properties `offsetTop`, `offsetLeft`, `offsetWidth`, and `offsetHeight` that always return `0`, and `offsetParent` which always returns `null`, for all HTML elements. (yefremov) * Fixed various edge cases in our type conversions applied to method arguments and setters throughout the web platform APIs implemented by jsdom. ## 9.10.0 * Added `forEach`, `keys`, `values`, and `entries` methods to `NodeList`. * Added `event.cancelBubble`. * Added dummy properties `scrollWidth`, `scrollHeight`, `clientTop`, `clientLeft`, `clientWidth`, and `clientHeight` that always return `0` to all elements. (alistairjcbrown) * Updated many aspects of `Blob`, `File`, and `FileReader` to better match the File API specification. (TimothyGu) * Fixed the progress and readystatechange events fired by `XMLHttpRequest` to match recent specification changes and test updates. * Fixed `element.getClientRects()` to return an empty array, instead of an array containing a dummy bounding box. (alistairjcbrown) * Changed `navigator.vendor` to return `"Apple Computer, Inc."` instead of `"Google Inc."`, since we have chosen the WebKit [navigator compatibility mode](https://html.spec.whatwg.org/multipage/webappapis.html#concept-navigator-compatibility-mode). ## 9.9.1 * Removed the use of `array.includes` to fix a compatibility issue with Node.js v4. ## 9.9.0 * Added `CDATASection` nodes, including `document.createCDATASection`. (snuggs) * Added `node.wholeText`. (jdanyow) * Added a setter for `document.body`. * Added `document.embeds`, `document.plugsin`, and `document.scripts`. These were supposed to be added in 9.5.0 but were mistakenly omitted. * Fixed `element.insertAdjacentHTML` to work when the element has null or the document as its parent node, as long as the insertion position is `"afterbegin"` or `"beforeend"`. * Fixed form submission to only hit the "not implemented" virtual console message when form submission is _not_ canceled, instead of when it is. * Fixed an issue where the event listener was not being correctly removed when using the `{ once: true }` option to `addEventListener`. (i8-pi) * Fixed an error that was thrown when using `XHTMLHttpRequest` and POSTing JSON contents to an endpoint that requires CORS while using an `Authorization` header. (dunnock) * Fixed `document.body` and `document.title` to act more correctly in various edge cases. * Fixed `HTMLCollection` named access to return the first element encountered, not the last. ## 9.8.3 * Fixed syntax errors in Node.js v4. ## 9.8.2 * Fixed `DOMTokenList` and `getElementsByClassName` to only split on ASCII whitespace, not all Unicode whitespace. ## 9.8.1 * Fixed an error that occurred when passing no class names to `getElementsByClassName`, e.g. `getElementsByClassName("")` or `getElementsByClassName(" ")`. ## 9.8.0 * Added the `blob.isClosed` property. (TimothyGu) * Fixed the `file.lastModified` property to be on `File` instead of on `Blob`. (TimothyGu) * Fixed the `file.lastModified` property to default to the time of the `File` object's creation, not the time that the property is accessed. (TimothyGu) * Fixed a minor edge-case regression where non-HTML elements with the name `"iframe"` became focusable in v9.7.0. ## 9.7.1 * Fixed a performance regression introduced in 9.5.0 for modifying the DOM. It was particularly noticable during initial parsing of a document with many elements; for example, one test showed parsing ten thousand elements taking 36.4 seconds, whereas after this fix it is back to a more reasonable 0.4 seconds. ## 9.7.0 * Added `EventListenerOptions` support to `addEventListener` and `removeEventListener`, including both the `once` and `capture` options. (GianlucaGuarini) * Added `document.hasFocus()` (acusti) * Fixed the focus management to ensure that focusing something inside an `iframe` will also focus the `iframe` itself. (acusti) ## 9.6.0 * Added `HTMLCollection.prototype[Symbol.iterator]`, so you can use `for`-`of` loops over `HTMLCollection`s now. (i8-pi) * Fixed `file.lastModified` to return the current time as the default, instead of `0`. * Fixed cloning of `Attr`s to properly clone the namespace prefix. * Tweaked `XMLHttpRequest` progress event ordering slightly to better match the spec and browsers. * Tweaked the behavior of calling `event.stopPropagation` and `event.stopImmediatePropagation` on already-dispatched events, per [the latest changes to the DOM Standard](https://github.com/whatwg/dom/commit/806d4aab584f6fc38c21f8e088b51b8ba3e27e20). ## 9.5.0 * Added `document.scripts`, `document.embeds`, and `document.plugins`. * Fixed `document.getElementsByTagName` and `document.getElementsByTagNameNS` to return `HTMLCollection`s instead of `NodeList`s, and to follow the spec algorithms more exactly. * Fixed various `HTMLCollection`-returning getters such as `document.applets` or `table.cells` to be more spec-compliant. * Fixed the resource loader to respect the `agent` and `agentClass` options, not just the `agentOptions` one. * Fixed `console.groupCollapse` to be `console.groupCollapsed` (and changed the virtual console accordingly). ## 9.4.5 * Fixed `error` events from failed resource loads going missing since v9.4.3. I really should have tested that release better. ## 9.4.4 * Fixed a leftover `console.log` introduced in the error handling path in v9.4.3. ## 9.4.3 * Fixed spurious `"jsdomError"`s occuring when closing a window, due to aborted resource loads. ## 9.4.2 * Fixed what would happen when inline event handlers (such as `element.onclick`) would return non-boolean values (such as `undefined`); it would previously erroneously cancel the event, in many cases. (dmethvin) * Upgraded the minimum tough-cookie version to ensure all installations are protected against [a security advisory](https://nodesecurity.io/advisories/130). ## 9.4.1 * Implemented the cloning steps for `<input>` elements, so that cloned inputs properly copy over their value, checkedness, dirty value flag, and dirty checkedness flag. (matthewp) ## 9.4.0 * Added the `DOMParser` API. It is spec-compliant, including producing `<parsererror>` elements, except that the produced documents do not have the same URL as the creating document (they instead always have `"about:blank"`). * Added strict XML parsing when using `parsingMode: "xml"`. Creating documents will now fail, just like in a browser, when ill-formed XHTML markup is used. * Added some rudimentary application of XML `<!ENTITY` declarations. * Added `window.frameElement`, although without appropriate cross-origin security checks. * Added the `jsdom.evalVMScript` public API. * Added more custom request agent support: you can now pass `agent` and `agentClass` in addition to `agentOptions`. (frarees) * Updated our elements-being-disabled semantics to more closely match the spec, in particular with regard to being descendants of `<fieldset disabled>`. * Updated `FormData` for [recent spec fixes](https://github.com/whatwg/xhr/commit/1a75845e67792418a7721d516266ad01a90f2062): blobs, files, and filenames should now all work like you'd expect. * Updated the `FormData` constructor to use the proper, rather-complex, [constructing the form data set](https://html.spec.whatwg.org/multipage/forms.html#constructing-form-data-set) algorithm. * Fixed all constructors that appears as globals on the jsdom `window` object to be non-enumerable. * Fixed `<script>` elements to load when they gain a `src` attribute while in a document. * Fixed `<link rel="stylesheet">` elements to load when their `href` attributes change while in a document. * Fixed the loading of external `<img>`s (when the `canvas` npm package is installed) that were specified via relative URL; this regressed in 9.2.1. * Fixed `<iframe>` documents to have the correct `referrer` value (viz. the URL of their parent). * Fixed the value of `input.checked` inside `click` events on checkboxes. * Fixed the window object's named properties to correctly return the `<iframe>` element or the `<iframe>`'s window in appropriate scenarios involving `name` vs. `id` attributes on the `<iframe>`. (matthewp) ## 9.3.0 * Added the `Audio` named constructor. * Fixed the `Image` named constructor to follow the spec more closely (e.g. `Image.prototype` is now equal to `HTMLImageElement.prototype`). * Fixed the `tabIndex` setter, which regressed in 9.1.0, to no longer cause errors. * Made submit buttons and labels respond to click event cancelation correctly, preventing form submission and re-dispatching to the relevant form control. (marcandre) * Fixed unhandled errors thrown in XHR event handlers being swallowed; they now properly are redirected to the virtual console. ## 9.2.1 * Fixed `<input>`'s `selectionStart`, `selectionEnd`, and `selectionDirection` getters to return null, instead of throwing, for elements that do not allow selection, per [a recent spec change](https://github.com/whatwg/html/pull/1006). * Fixed `<base>`'s `href` getter logic to return the attribute value instead of the empty string for unparseable URLs, per [a recent spec change](https://github.com/whatwg/html/pull/1064). * Fixed the referrer sent when retrieving external resources to be the document's URL, not the document's base URL. * Fixed suppression of all `error` events on `window` beyond the first one. * Fixed `new URL` to correctly throw for unparseable URLs, and all of `URL`'s setters to correctly ignore invalid input instead of throwing. * Fixed `StyleSheetList.prototype.item` to return `null` instead of `undefined` for out-of-bounds indices. (Ginden) * Updated `cssstyle` minimum version to ensure all jsdom installs (not just fresh ones) get the benefit of `cssstyle`'s recently-better `background` and `width` setters. ## 9.2.0 * Added `jsdom.changeURL(window, newURL)` for allowing you to override a window's existing URL. (mummybot) * Fixed the `proxy` option to be applied to all requests; previously it was not always passed through. (nicolashenry) * Fixed `XMLHttpRequest` response header filtering for cross-origin requests; this also fixes `ProgressEvent`s fired from such XHRs. (nicolashenry) ## 9.1.0 * Added a somewhat-reasonable implementation of focus and focus events. Although the full complexity of focus is not implemented, the following improvements have been made: - Only elements which are focusable can be focused. - Added the `FocusEvent` class, and now `focus` and `blur` events are fired appropriately. - `tabIndex` now returns `0` by default for focusable elements. * Reimplemented `navigator` to be to-spec: - Added `appCodeName`, `product`, `productSub`, `vendor`, and `vendorSub`; also changes `userAgent`, `appName`, `platform`, and `version` to be more browser-like instead of based on various Node.js information. - Added `language` and `languages`. - Added `onLine`. - Added `javaEnabled()`. - Removed `noUI`. * Fixed `formEl.action` to return a value resolved relative to the document URL, or to return the document URL if the corresponding attribute is missing or empty. * Sped up XPath execution. (vsemozhetbyt) * Fixed `window.close()` not correctly clearing event listeners on the document. (Ojek) * Fixed a regression introduced in v9.0.0 where invalid CSS would cause a crash while attempting to parse it. Instead, a `"jsdomError"` will now be emitted to the virtual console. ## 9.0.0 This major release removes jsdom's support for mutation events. Mutation events were never well-specified, and the modern DOM Standard omits them in the hopes that they can be removed from browsers (although this has not yet happened in major browser engines). We had hoped to implement their modern alternative, mutation observers, before performing this removal, to give jsdom users the same capabilities. However, recent performance investigations revealed that mutation events were the major bottleneck in most jsdom operations; tools like [ecmarkup](https://github.com/bterlson/ecmarkup) which make heavy use of jsdom had their running time halved by removing mutation events, which add serious overhead to every DOM mutation. As such, we are doing a major release with them removed, so that jsdom users can benefit from this massive performance gain. Mutation observer support is [in progress](https://github.com/tmpvar/jsdom/issues/639); please use the GitHub reactions feature to vote on that issue if you are impacted by this removal and are hoping for mutation observer support to replace it. Your normal change log follows: * **Removed mutation events**, as discussed above. * Added the `DOMTokenList.prototype.replace` method. (nicolashenry) * Updated `DOMTokenList.prototype.contains` to no longer validate its arguments, as per the latest spec. (nicolashenry) * Made various improvements to XMLHttpRequest (nicolashenry): - Added the `responseURL` property. - Updated methods, headers, and header values to use the `ByteString` algorithm. - Fixed the default `statusText` to be `""` instead of `"OK"`. * Fixed the `Blob` constructor's `type` validation. (nicolashenry) ## 8.5.0 * Added encoding handling (nicolashenry) - `jsdom.env`, when given a URL or file, will decode the resulting bytes using signals like the `Content-Type` header, `<meta charset>` declaration, or presence of a BOM, in the same manner as web browsers. - Fetching external resources, via mechanisms such as XMLHttpRequest or `<script>`/`<link>`/`<iframe>` tags, will also account for such signals. - `jsdom.jsdom()`, which takes a string, still sets a "UTF-8" encoding by default, since there are no bytes or headers for it to sniff an encoding from. * Removed `iframe.sandbox` property, since it was not implemented and simply crashed when used. * Removed `element.sourceIndex` property, since it was nonstandard (Internet Explorer only). * Fixed setting proxied inline event handlers, such as `doc.body`'s `onload=""` attribute, for documents that do not have a browsing context. ## 8.4.1 * Fixed an issue where setting `selected` on an multi-select would clear all other selectedness. ## 8.4.0 * Added an implementation of the `TreeWalker` class (and `document.createTreeWalker`). (garycourt) * Fixed a few minor bugs in URL parsing and the `URL` API, by upgrading to `whatwg-url` v2.0.1. * Fixed a few issues with generated files in the published package, which seem to have impacted webpack users. ## 8.3.1 * Fixed an issue where if you modified `Object.prototype`, spurious attributes would show up on your jsdom nodes. (deckar01) ## 8.3.0 * Added image loading and decoding, when the `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 loads * `load` and `error` events will fire on the `<img>` element, according to how well image decoding goes. * You can draw images onto canvases, using the newly-enabled `canvasContext.drawImage` API. * Added `canvasContext.createPattern` and `canvasContext.toBlob`, when the `canvas` npm package is installed. (lehni) * Added a basic implementation of the [Page Visibility API](https://w3c.github.io/page-visibility/), in particular a `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) ## 8.2.0 * Added correct click behavior for inputs (jeffcarp): - `change` and `input` events now fire appropriately - The "click in progress" flag is implemented, so you cannot click while a click is in progress - Canceling a click event appropriately resets radio buttons and checkboxes * Updated our XMLHttpRequest implementation with a variety of fixes and features, including preliminary CORS support. (nicolashenry) * Added a `strictSSL` top-level option to govern all requests jsdom makes. (nicolashenry) * XHTML frames and iframes are now parsed as XML instead of HTML. (nicolashenry) * Added `document.origin` and `document.lastModified`. (nicolashenry) * Fixed the `scriptEl.text` getter and setter to follow the spec. * Fixed script execution to check against the canonical list of JavaScript MIME types and only execute those scripts as JavaScript. ## 8.1.1 * Fixed input selection methods and properties to properly differentiate between inputs that can be selected outright vs. textual inputs which allow variable-length selection. (yaycmyk) ## 8.1.0 * Added `attr.nodeName`, which was [recently re-added to the spec](https://github.com/whatwg/dom/issues/171). * Added click-proxying behavior from `<label>`s to their labeled form elements. (yaycmyk) * Added a setter for `element.classList` per recent spec changes (it forwards to `element.classList.value`). * Updated our attributes implementation in a few ways for recent spec changes and to fix discovered bugs: - Added `element.getAttributeNames()`. ([spec