1# Version history 2 3# 6.0.1 4* Fixed: Handling of self-closing `<hr>` tags (by [@43081j](https://github.com/43081j)). 5* Fixed: Broken link in TreeAdapter document (GH [#317](https://github.com/inikulin/parse5/issues/317)) (by [@ursm](https://github.com/ursm)). 6* Fixed: SAXParser example (GH [#316](https://github.com/inikulin/parse5/issues/316)) (by [@mvasilkov](https://github.com/mvasilkov)). 7 8# 6.0.0 9* Added (**breaking**): Tree adapter interface now has `updateNodeSourceCodeLocation` method which 10enables usage of custom location info formats (GH [#314](https://github.com/inikulin/parse5/issues/314)) (by [@DMartens](https://github.com/DMartens)). 11 12 13# 5.1.1 14* Fixed: Serialization of attributes in non-standard namespaces (by [@Zirro](https://github.com/Zirro)). 15* Fixed: Quirks and limited-quirks mode detection by doctype (by [@squidfunk](https://github.com/squidfunk)). 16 17# 5.1.0 18 19* Fixed: Location info for `text` events in `SAXParser` and `RewritingStream` now contains 20correct `endCol` and `endLine` covering all concatenated raw tokens (GH [#266](https://github.com/inikulin/parse5/issues/266)). 21* Fixed: `SAXParser` and `RewritingStream` now flush last buffered chunk when calling `.end()` with 22no parameters (GH [#271](https://github.com/inikulin/parse5/issues/271)). 23* Updated (**breaking**): `ParserStream`, `SAXParser` and `RewritingStream` no longer assume that 24each binary chunk is a valid finished UTF-8 chunk, and instead accept only decoded strings (GH [#269](https://github.com/inikulin/parse5/issues/269)). 25 26# 5.0.0 27 28Starting from this release `parse5` functionality will be shipped in separate packages. 29With `parse5` package contatining only basic functionality. Please, refer to the [list of packages](https://github.com/inikulin/parse5/tree/master/) for more info. 30 31* Updated (**breaking**): source code location now inserted by tree adapter, so tree adapter developers 32have control over location info property name. Tree adapters should implement [setNodeSourceCodeLocation](https://github.com/inikulin/parse5/blob/master/packages/parse5/docs/tree-adapter/interface.md#setnodesourcecodelocation) and 33[getNodeSourceCodeLocation](https://github.com/inikulin/parse5/blob/master/packages/parse5/docs/tree-adapter/interface.md#getnodesourcecodelocation) methods. 34Location info property name added by currently implemented tree adapters has been renamed from `__location` to `sourceCodeLocation` 35(GH [#189](https://github.com/inikulin/parse5/issues/189)). 36 37* Updated (**breaking**): Location info `line` and `col` properties have been renamed to [startLine](https://github.com/inikulin/parse5/blob/master/packages/parse5/docs/source-code-location/location.md#startline) and 38[startCol](https://github.com/inikulin/parse5/blob/master/packages/parse5/docs/source-code-location/location.md#startcol) 39respectively. 40 41* Updated (**breaking**): `SAXParser` now passes token objects to event handlers instead of separate arguments. See [SAXParser documentation](https://github.com/inikulin/parse5/blob/master/packages/parse5-sax-parser/docs/index.md) for more info. 42(GH [#247](https://github.com/inikulin/parse5/issues/247)). 43 44* Added: [endLine](https://github.com/inikulin/parse5/blob/master/packages/parse5/docs/source-code-location/location.md#endline) and [endCol](https://github.com/inikulin/parse5/blob/master/packages/parse5/docs/source-code-location/location.md#endcol) location info 45properties. 46 47* Added: [scriptingEnabled](https://github.com/inikulin/parse5/blob/master/packages/parse5/docs/options/parser-options.md#scriptingenabled) flag to the `ParserOptions` which controls how `<noscript>` tags are handled by the parser. (GH [#192](https://github.com/inikulin/parse5/issues/192)). 48 49* Added: [HTML rewriting stream](https://github.com/inikulin/parse5/tree/master/packages/parse5-html-rewriting-stream#readme). 50(GH [#222](https://github.com/inikulin/parse5/issues/222)). 51 52* Removed (**breaking**): `parse5` no longer ship TypeScript definitions. Existing TypeScript definitions 53have been moved to DefinitelyTyped repo. Please, track the [PR](https://github.com/DefinitelyTyped/DefinitelyTyped/pull/25943) in the DefinitelyTyped repo for the updates. 54 55 56## 4.0.0 57This is a major release that delivers few minor (but breaking) changes to workaround recently appeared 58issues with TypeScript Node.js typings versioning and usage of parse5 in environments that are 59distinct from Node.js (see https://github.com/inikulin/parse5/issues/235 for the details). 60 61* Updated (**breaking**): TypeScript were disabled by default. See [TypeScript definitions](#typescript-definitions) section 62for the details on how to enable them. 63* Updated: API that depends on Node.js specific (namely `ParserStream`, `PlainTextConversionStream`, 64`SerializerStream`, `SAXParser`) is now lazily loaded. That enables bundling of the basic functionality 65for other platforms (e.g. for browsers via webpack). 66 67## 3.0.3 68* Fixed: Loosen the dependency version of `@types/node` (by [@gfx](https://github.com/gfx)). 69* Fixed: Incorrect AST generated if empty string fed to `ParserStream` (GH [#195](https://github.com/inikulin/parse5/issues/195)) (by [@stevenvachon](https://github.com/stevenvachon)). 70 71## 3.0.2 72* Fixed: `location.startTag` is not available if end tag is missing (GH [#181](https://github.com/inikulin/parse5/issues/181)). 73 74## 3.0.1 75* Fixed: `MarkupData.Location.col` description in TypeScript definition file (GH [#170](https://github.com/inikulin/parse5/issues/170)). 76 77## 3.0.0 78* Added: parse5 now ships with TypeScript definitions from which [new documentation website](http://inikulin.github.io/parse5/) is generated (GH [#125](https://github.com/inikulin/parse5/issues/125)). 79* Added: [PlainTextConversionStream](http://inikulin.github.io/parse5/classes/plaintextconversionstream.html) (GH [#135](https://github.com/inikulin/parse5/issues/135)). 80* Updated: [Significantly reduced initial memory consumption](https://github.com/inikulin/parse5/tree/master/scripts/generate_named_entity_data#named-entity-array-mapped-radix-tree-generator) (GH [#52](https://github.com/inikulin/parse5/issues/52)). 81* Updated (**breaking**): Added support for limited quirks mode. `document.quirksMode` property was replaced with `document.mode` property which can have 82 `'no-quirks'`, `'quirks'` and `'limited-quirks'` values. Tree adapter `setQuirksMode ` and `isQuirksMode` methods were replaced with `setDocumentMode` and `getDocumentMode` methods (GH [#83](https://github.com/inikulin/parse5/issues/83)). 83* Updated (**breaking**): AST collections (e.g. attributes dictionary) don't have prototype anymore (GH [#119](https://github.com/inikulin/parse5/issues/119)). 84* Updated (**breaking**): Doctype now always serialized as `<!DOCTYPE html>` as per spec (GH [#137](https://github.com/inikulin/parse5/issues/137)). 85* Fixed: Incorrect line for `__location.endTag` when the start tag contains newlines (GH [#166](https://github.com/inikulin/parse5/issues/166)) (by [@webdesus](https://github.com/webdesus)). 86 87## 2.2.3 88 * Fixed: Fixed incorrect LocationInfo.endOffset for non-implicitly closed elements (refix for GH [#109](https://github.com/inikulin/parse5/issues/109)) (by [@wooorm](https://github.com/wooorm)). 89 90## 2.2.2 91 * Fixed: Incorrect location info for text in SAXParser (GH [#153](https://github.com/inikulin/parse5/issues/153)). 92 * Fixed: Incorrect `LocationInfo.endOffset` for implicitly closed `<p>` element (GH [#109](https://github.com/inikulin/parse5/issues/109)). 93 * Fixed: Infinite input data buffering in streaming parsers. Now parsers try to not buffer more than 64K of input data. 94 However, there are still some edge cases left that will lead to significant memory consumption, but they are quite exotic 95 and extremely rare in the wild (GH [#102](https://github.com/inikulin/parse5/issues/102), GH [#130](https://github.com/inikulin/parse5/issues/130)); 96 97 98## 2.2.1 99 * Fixed: SAXParser HTML integration point handling for adjustable SVG tags. 100 * Fixed: SAXParser now adjust SVG tag names for end tags. 101 * Fixed: Location info line calculation on tokenizer character unconsumption (by [@ChadKillingsworth](https://github.com/ChadKillingsworth)). 102 103## 2.2.0 104* SAXParser (by [@RReverser](https://github.com/RReverser)) 105 * Fixed: Handling of `\n` in `<pre>`, `<textarea>` and `<listing>`. 106 * Fixed: Tag names and attribute names adjustment in foreign content (GH [#99](https://github.com/inikulin/parse5/issues/99)). 107 * Fixed: Handling of `<image>`. 108 109* Latest spec changes 110 * Updated: `<isindex>` now don't have special handling (GH [#122](https://github.com/inikulin/parse5/issues/122)). 111 * Updated: Adoption agency algorithm now preserves lexical order of text nodes (GH [#129](https://github.com/inikulin/parse5/issues/129)). 112 * Updated: `<menuitem>` now behaves like `<option>`. 113 114* Fixed: Element nesting corrections now take namespaces into consideration. 115 116## 2.1.5 117 * Fixed: ParserStream accidentally hangs up on scripts (GH [#101](https://github.com/inikulin/parse5/issues/101)). 118 119## 2.1.4 120 * Fixed: Keep ParserStream sync for the inline scripts (GH [#98](https://github.com/inikulin/parse5/issues/98) follow up). 121 122## 2.1.3 123 * Fixed: Synchronously calling resume() leads to crash (GH [#98](https://github.com/inikulin/parse5/issues/98)). 124 125## 2.1.2 126 * Fixed: SAX parser silently exits on big files (GH [#97](https://github.com/inikulin/parse5/issues/97)). 127 128## 2.1.1 129 * Fixed: location info not attached for empty attributes (GH [#96](https://github.com/inikulin/parse5/issues/96)) 130 (by [@yyx990803](https://github.com/yyx990803)). 131 132## 2.1.0 133 * Added: location info for attributes (GH [#43](https://github.com/inikulin/parse5/issues/43)) (by [@sakagg](https://github.com/sakagg) 134 and [@yyx990803](https://github.com/yyx990803)). 135 * Fixed: `parseFragment` with `locationInfo` regression when parsing `<template>`(GH [#90](https://github.com/inikulin/parse5/issues/90)) 136 (by [@yyx990803](https://github.com/yyx990803)). 137 138## 2.0.2 139 * Fixed: yet another case of incorrect `parseFragment` arguments fallback (GH [#84](https://github.com/inikulin/parse5/issues/84)). 140 141## 2.0.1 142 * Fixed: `parseFragment` arguments processing (GH [#82](https://github.com/inikulin/parse5/issues/82)). 143 144## 2.0.0 145 * Added: [ParserStream](https://github.com/inikulin/parse5/wiki/Documentation#parse5+ParserStream) with the scripting support. (GH [#26](https://github.com/inikulin/parse5/issues/26)). 146 * Added: [SerializerStream](https://github.com/inikulin/parse5/wiki/Documentation#parse5+SerializerStream). (GH [#26](https://github.com/inikulin/parse5/issues/26)). 147 * Added: Line/column location info. (GH [#67](https://github.com/inikulin/parse5/issues/67)). 148 * Update (**breaking**): Location info properties `start` and `end` were renamed to `startOffset` and `endOffset` respectively. 149 * Update (**breaking**): `SimpleApiParser` was renamed to [SAXParser](https://github.com/inikulin/parse5/wiki/Documentation#parse5+SAXParser). 150 * Update (**breaking**): [SAXParser](https://github.com/inikulin/parse5/wiki/Documentation#parse5+SAXParser) is the [transform stream](https://nodejs.org/api/stream.html#stream_class_stream_transform) 151 now. (GH [#26](https://github.com/inikulin/parse5/issues/26)). 152 * Update (**breaking**): [SAXParser](https://github.com/inikulin/parse5/wiki/Documentation#parse5+SAXParser) handler subscription is done via events now. 153 * Added: [SAXParser.stop()](https://github.com/inikulin/parse5/wiki/Documentation#parse5+SAXParser+stop). (GH [#47](https://github.com/inikulin/parse5/issues/47)). 154 * Add (**breaking**): [parse5.parse()](https://github.com/inikulin/parse5/wiki/Documentation#parse5+parse) and [parse5.parseFragment()](https://github.com/inikulin/parse5/wiki/Documentation#parse5+parseFragment) 155 methods as replacement for the `Parser` class. 156 * Add (**breaking**): [parse5.serialize()](https://github.com/inikulin/parse5/wiki/Documentation#parse5+serialized) method as replacement for the `Serializer` class. 157 * Updated: parsing algorithm was updated with the latest [HTML spec](https://html.spec.whatwg.org/) changes. 158 * Removed (**breaking**): `decodeHtmlEntities` and `encodeHtmlEntities` options. (GH [#75](https://github.com/inikulin/parse5/issues/75)). 159 * Add (**breaking**): [TreeAdapter.setTemplateContent()](https://github.com/inikulin/parse5/wiki/Documentation#TreeAdapter.setTemplateContent) and [TreeAdapter.getTemplateContent()](https://github.com/inikulin/parse5/wiki/Documentation#TreeAdapter.getTemplateContent) methods. (GH [#78](https://github.com/inikulin/parse5/issues/78)). 160 * Update (**breaking**): `default` tree adapter now stores `<template>` content in `template.content` property instead of `template.childNodes[0]`. 161 162## 1.5.1 163 * Fixed: Qualified tag name emission in Serializer (GH [#79](https://github.com/inikulin/parse5/issues/79)). 164 165## 1.5.0 166 * Added: Location info for the element start and end tags (by [@sakagg](https://github.com/sakagg)). 167 168## 1.4.2 169 * Fixed: htmlparser2 tree adapter `DocumentType.data` property rendering (GH [#45](https://github.com/inikulin/parse5/issues/45)). 170 171## 1.4.1 172 * Fixed: Location info handling for the implicitly generated `<html>` and `<body>` elements (GH [#44](https://github.com/inikulin/parse5/issues/44)). 173 174## 1.4.0 175 * Added: Parser [decodeHtmlEntities](https://github.com/inikulin/parse5#optionsdecodehtmlentities) option. 176 * Added: SimpleApiParser [decodeHtmlEntities](https://github.com/inikulin/parse5#optionsdecodehtmlentities-1) option. 177 * Added: Parser [locationInfo](https://github.com/inikulin/parse5#optionslocationinfo) option. 178 * Added: SimpleApiParser [locationInfo](https://github.com/inikulin/parse5#optionslocationinfo-1) option. 179 180## 1.3.2 181 * Fixed: `<form>` processing in `<template>` (GH [#40](https://github.com/inikulin/parse5/issues/40)). 182 183## 1.3.1 184 * Fixed: text node in `<template>` serialization problem with custom tree adapter (GH [#38](https://github.com/inikulin/parse5/issues/38)). 185 186## 1.3.0 187 * Added: Serializer `encodeHtmlEntities` option. 188 189## 1.2.0 190 * Added: `<template>` support 191 * `parseFragment` now uses `<template>` as default `contextElement`. This leads to the more "forgiving" parsing manner. 192 * `TreeSerializer` was renamed to `Serializer`. However, serializer is accessible as `parse5.TreeSerializer` for backward compatibility . 193 194## 1.1.6 195 * Fixed: apply latest changes to the `htmlparser2` tree format (DOM Level1 node emulation). 196 197## 1.1.5 198 * Added: [jsdom](https://github.com/tmpvar/jsdom)-specific parser with scripting support. Undocumented for `jsdom` internal use only. 199 200## 1.1.4 201 * Added: logo 202 * Fixed: use fake `document` element for fragment parsing (required by [jsdom](https://github.com/tmpvar/jsdom)). 203 204## 1.1.3 205 * Development files (e.g. `.travis.yml`, `.editorconfig`) are removed from NPM package. 206 207## 1.1.2 208 * Fixed: crash on Linux due to upper-case leading character in module name used in `require()`. 209 210## 1.1.1 211 * Added: [SimpleApiParser](https://github.com/inikulin/parse5/#class-simpleapiparser). 212 * Fixed: new line serialization in `<pre>`. 213 * Fixed: `SYSTEM`-only `DOCTYPE` serialization. 214 * Fixed: quotes serialization in `DOCTYPE` IDs. 215 216## 1.0.0 217 * First stable release, switch to semantic versioning. 218 219## 0.8.3 220 * Fixed: siblings calculation bug in `appendChild` in `htmlparser2` tree adapter. 221 222## 0.8.1 223 * Added: [TreeSerializer](https://github.com/inikulin/parse5/#class-serializer). 224 * Added: [htmlparser2 tree adapter](https://github.com/inikulin/parse5/#-treeadaptershtmlparser2). 225 226## 0.6.1 227 * Fixed: incorrect `<menuitem>` handling in `<body>`. 228 229## 0.6.0 230 * Initial release. 231