blob: b6b80799aef46804436a421576ac114ecf6c49c5 [file] [view] [edit]
## 0.15.8-wip
- Reduce allocations when parsing and serializing: `HtmlInputStream` no longer copies the input when it needs no newline or surrogate normalization, and `htmlSerializeEscape` copies unescaped runs at once and returns the input unchanged when nothing needs escaping.
- Fix `Element.text`, `DocumentFragment.text` and `Node.textContent` throwing a `StackOverflowError` on very deeply nested elements; text is now extracted iteratively.
- Fix `Node.remove` and `NodeList.remove` leaving a stale `parentNode`, `Node.insertBefore`, `NodeList.insert`, `insertAll` and `operator []=` using a shifted index when moving an earlier sibling, and `reparentChildren` emptying a node reparented to itself. Moving all children of another node (`append` of a `DocumentFragment`, `reparentChildren`, `innerHtml`) now runs in linear time.
- `getElementById`, `getElementsByTagName` and `getElementsByClassName` no longer parse a CSS selector. IDs and class names that are not valid CSS identifiers (such as `a:b`, `a.b` or `1`) now match exactly instead of throwing or matching the wrong element, `getElementById('')` returns `null`, class names are split on HTML ASCII whitespace, and deeply nested documents no longer overflow the stack. `getElementsByTagName` now matches a single tag name, as in the DOM spec, so selector lists or combinators such as `'h1, h2'` return an empty list, and `''` returns an empty list instead of throwing.
- Fix `querySelector` and `querySelectorAll` matching of `:root` (now the
element whose parent is the `Document`) and numeric `:nth-child(n)` (now
counts element siblings from 1), and traverse descendants iteratively so
deeply nested documents no longer overflow the stack.
- Class selectors, `[attr~=value]` selectors and `Element.classes` now split
their values on ASCII whitespace (space, tab, LF, FF, CR) as the HTML
standard requires.
- `</br>` and `</p>` end tags in foreign content (`<svg>`, `<math>`) now exit foreign content before reprocessing in HTML mode, matching the WHATWG HTML standard.
- `<` and `>` are now escaped as `&lt;` and `&gt;` when serializing attribute values in `htmlSerializeEscape`, `innerHtml`, and `outerHtml`, matching the WHATWG HTML standard.
- Fix `Node.attributeSpans` and `Node.attributeValueSpans` throwing a `TypeError` when a start tag emits tokenizer parse errors, and preserve the first occurrence's span on duplicate attributes.
- Fix `HtmlInputStream` throwing a `FormatException` on malformed UTF-8 or invalid ASCII byte sequences, and ignore `<meta charset>` declarations that resolve to unsupported Dart codecs.
- Fix `HtmlTokenizer.consumeNumberEntity` throwing a `FormatException` when a numeric character reference overflows a 64-bit integer.
- Fix `EncodingParser` failing to parse `<meta charset>` attributes with whitespace before `=`, unquoted `charset` values at the end of `content` attributes, and truncated attributes at EOF.
- Fix `querySelector` and `querySelectorAll` throwing a null-check `TypeError` instead of `FormatException` on empty `:not()` selectors.
- Fix `TreeBuilder` not updating `Text.sourceSpan` when merging consecutive foster-parented text nodes before a `<table>`.
- Fix `ParseError.message` throwing a null-check `TypeError` on `unexpected-EOF-after-attribute-value` tokenizer errors, and align tokenizer error codes `this-closing-flag-on-end-tag` -> `self-closing-flag-on-end-tag` and `expected-end-of-tag-but-got-eof` -> `expected-end-of-tag-name-but-got-eof` with `errorMessages`.
- Fix the `:empty` and `:blank` selectors not matching elements without child nodes, and matching elements that have a child element next to a comment.
## 0.15.7
- `writeTextNodeAsHtml`: Escape text inside `<script>` and `<style>`-like tags in foreign namespaces.
- Fix the tokenizer failing to close CDATA blocks when encountering extra brackets
- Require Dart `3.6`
- Limit ["Noah's Ark" clause](https://html.spec.whatwg.org/multipage/parsing.html#list-of-active-formatting-elements) to avoid degenerate O(N^2) when parsing deeply nested formatting elements with unique attributes.
- Added new `textContent` method to `Node` class that returns the text content of
the node.
- Fix XSS vulnerability in `htmlToCodeMarkup()` by escaping DOCTYPE, element, and attribute names.
## 0.15.6
- Performance improvements.
- No longer generate any error spans if generateSpans is false.
- Fixed a TypeError in nth-child with non numeric value (e.g. `nth-child(even)`)
## 0.15.5+1
- Support "ambiguous ampersand" in attribute values.
## 0.15.5
- Require Dart `3.2`.
- Move to `dart-lang/tools` monorepo.
## 0.15.4
- Widen the dependency on `package:csslib`.
- Require Dart `2.19`.
## 0.15.3
- Added package topics to the pubspec file.
## 0.15.2
- Add additional types at the API boundary (in `lib/parser.dart` and others).
- Adopted the `package:dart_flutter_team_lints` linting rules.
- Fixed an issue with `querySelector` where it would fail in some cases with
descendant or sibling combinators (#157).
- Add an API example in `example/`.
## 0.15.1
- Move `htmlSerializeEscape` to its own library,
`package:html/html_escape.dart`, which is exported from
`package:html/dom_parsing.dart`.
- Use more non-growable lists, and type annotations on List literals.
- Switch analysis option `implicit-casts: false` to `strict-casts: true`.
## 0.15.0
- Migrate to null safety.
- Drop `lastPhase`, `beforeRcDataPhase`, and `container` fields from
`HtmlParser` class. These fields never had a value other than `null`.
## 0.14.0+4
- Fix a bug parsing bad HTML where a 'button' end tag needs to close other
elements.
## 0.14.0+3
- Fix spans generated for HTML with higher-plane unicode characters
(eg. emojis).
## 0.14.0+2
- Support `package:css` `>=0.13.2 <0.17.0`.
## 0.14.0+1
- Support `package:css` `>=0.13.2 <0.16.0`.
## 0.14.0
*BREAKING CHANGES*
- Drop support for encodings other than UTF-8 and ASCII.
- Removed `parser_console.dart` library.
## 0.13.4+1
* Fixes to readme and pubspec.
## 0.13.4
* Require Dart 2.0 stable.
## 0.13.3+3
* Do not use this tag in our systems - there was an earlier version of it
pointing to a different commit, that is still in some caches.
* Fix missing_return analyzer errors in `processStartTag` and `processEndTag`
methods.
## 0.13.3+2
* Set max SDK version to `<3.0.0`, and adjust other dependencies.
## 0.13.3+1
* Updated SDK version to 2.0.0-dev.17.0
## 0.13.3
* Update the signatures of `FilteredElementList.indexOf` and
`FilteredElementList.lastIndexOf` to include type annotations.
## 0.13.2+2
* Update signature for implementations of `Iterable.singleWhere` to include
optional argument.
## 0.13.2+1
* Changed the implementation of `Set` and `List` classes to use base classes
from `dart:collection`.
## 0.13.2
* Support the latest release of `pkg/csslib`.
## 0.13.1
* Update Set.difference to take a Set<Object>.
## 0.13.0
* **BREAKING** Fix all [strong mode][] errors and warnings.
This involved adding more precise types on some public APIs, which is why it
may break users.
[strong mode]: https://github.com/dart-lang/dev_compiler/blob/master/STRONG_MODE.md
#### Pub version 0.12.2+2
* Support `csslib` versions `0.13.x`.
#### Pub version 0.12.2+1
* Exclude `.packages` file from the published package.
#### Pub version 0.12.2
* Added `Element.endSourceSpan`, containing the span of a closing tag.
#### Pub version 0.12.0+1
* Support `csslib` version `0.12.0`.
#### Rename to package:html 0.12.0
* package has been renamed to `html`
#### Pub version 0.12.0
* switch from `source_maps`' `Span` class to `source_span`'s
`SourceSpan` class.
#### Pub version 0.11.0+2
* expand the version constraint for csslib.
#### Pub version 0.10.0+1
* use a more recent source_maps version.
#### Pub version 0.10.0
* fix how document fragments are added in NodeList.add/addAll/insertAll.
#### Pub version 0.9.2-dev
* add Node.text, Node.append, Document.documentElement
* add Text.data, deprecate Node.value and Text.value.
* deprecate Node.$dom_nodeType
* added querySelector/querySelectorAll, deprecated query/queryAll.
This matches the current APIs in dart:html.