File tree 3 files changed +14
-3
lines changed 3 files changed +14
-3
lines changed Original file line number Diff line number Diff line change
1
+ ## 0.15.6-wip
2
+
3
+ - Fixed a TypeError in nth-child with non numeric value (e.g. ` nth-child(even) ` )
4
+
1
5
## 0.15.5+1
2
6
3
7
- Support "ambiguous ampersand" in attribute values.
Original file line number Diff line number Diff line change @@ -218,10 +218,17 @@ class SelectorEvaluator extends Visitor {
218
218
final exprs = node.expression.expressions;
219
219
if (exprs.length == 1 && exprs[0 ] is LiteralTerm ) {
220
220
final literal = exprs[0 ] as LiteralTerm ;
221
+
222
+ if (literal.value is ! num ) {
223
+ // non numeric values (e.g. `nth-child(even)`) are not supported
224
+ return false ;
225
+ }
226
+
227
+ final numericLiteral = literal.value as num ;
221
228
final parent = _element! .parentNode;
222
229
return parent != null &&
223
- (literal.value as num ) > 0 &&
224
- parent.nodes.indexOf (_element) == literal.value ;
230
+ numericLiteral > 0 &&
231
+ parent.nodes.indexOf (_element) == numericLiteral ;
225
232
}
226
233
break ;
227
234
Original file line number Diff line number Diff line change 1
1
name : html
2
- version : 0.15.5+1
2
+ version : 0.15.6-wip
3
3
description : APIs for parsing and manipulating HTML content outside the browser.
4
4
repository : https://github.com/dart-lang/tools/tree/main/pkgs/html
5
5
issue_tracker : https://github.com/dart-lang/tools/issues?q=is%3Aissue+is%3Aopen+label%3Apackage%3Ahtml
You can’t perform that action at this time.
0 commit comments