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