html
html copied to clipboard
querySelector doesn't successfully throw unimplemented error
The below code demonstrates that the querySelector() method successfully selects using just a class name or just a child, but doesn't work when combined, and returns null rather than throwing an unimplemented error, as per the docs.
import 'package:html/parser.dart' show parse;
main() {
var document = parse('<div class="foo"><img></div>');
var img1 = document.querySelector('div.foo img');
print(img1 == null); // true
var img2 = document.querySelector('div img');
print(img2 != null); // true
var div = document.querySelector('div.foo');
print(div != null); // true
}
do document.querySelector('div.foo').querySelector('img')