Skip to content

Commit 11f4cf7

Browse files
authored
[html] Various performance optimizations (#2019)
1 parent 98d4e4d commit 11f4cf7

File tree

11 files changed

+14576
-133
lines changed

11 files changed

+14576
-133
lines changed

pkgs/html/CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
## 0.15.6-wip
1+
## 0.15.6
22

3+
- Performance improvements.
4+
- No longer generate any error spans if generateSpans is false.
35
- Fixed a TypeError in nth-child with non numeric value (e.g. `nth-child(even)`)
46

57
## 0.15.5+1

pkgs/html/lib/parser.dart

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2026,7 +2026,7 @@ class InBodyPhase extends Phase {
20262026
}
20272027

20282028
void endTagHeading(EndTagToken token) {
2029-
for (var item in headingElements) {
2029+
for (var item in headingElementsList) {
20302030
if (tree.elementInScope(item)) {
20312031
tree.generateImpliedEndTags();
20322032
break;
@@ -2036,7 +2036,7 @@ class InBodyPhase extends Phase {
20362036
parser.parseError(token.span, 'end-tag-too-early', {'name': token.name});
20372037
}
20382038

2039-
for (var item in headingElements) {
2039+
for (var item in headingElementsList) {
20402040
if (tree.elementInScope(item)) {
20412041
var node = tree.openElements.removeLast();
20422042
while (!headingElements.contains(node.localName)) {
@@ -3972,6 +3972,9 @@ class ParseError implements SourceSpanException {
39723972

39733973
@override
39743974
String toString({dynamic color}) {
3975+
if (span == null) {
3976+
return message;
3977+
}
39753978
final res = span!.message(message, color: color);
39763979
return span!.sourceUrl == null ? 'ParserError on $res' : 'On $res';
39773980
}

0 commit comments

Comments
 (0)