html icon indicating copy to clipboard operation
html copied to clipboard

querySelector doesn't successfully throw unimplemented error

Open maxwell8888 opened this issue 4 years ago • 1 comments

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
}

maxwell8888 avatar Jun 28 '21 19:06 maxwell8888

do document.querySelector('div.foo').querySelector('img')

truxcoder avatar Mar 23 '22 12:03 truxcoder