Disable implicit casts (#130)

This will make it easier to migrate to null safety which also disables
implicit casts except from dynamic. Also fix the implicit casts from
dynamic since this package has a lot of dynamic code that is harder to
read with implicit casts.

- Add argument types to some signatures that should have had them from
  the start.
- Add explicit casts.
- Extract a few new local variables to make some of the casts only need
  to happen once.
- Use `Iterable.whereType` in a loop instead of a type check and
  `continue` in the loop body.
16 files changed
tree: 93411d59f57bc7729ed3f9f50cf904a1b932c683
  1. lib/
  2. test/
  3. .gitignore
  4. .test_config
  5. .travis.yml
  6. analysis_options.yaml
  7. CHANGELOG.md
  8. LICENSE
  9. pubspec.yaml
  10. README.md
README.md

This is a pure Dart HTML5 parser. It's a port of html5lib from Python.

Usage

Parsing HTML is easy!

import 'package:html/parser.dart' show parse;
import 'package:html/dom.dart';

main() {
  var document = parse(
      '<body>Hello world! <a href="www.html5rocks.com">HTML5 rocks!');
  print(document.outerHtml);
}

You can pass a String or list of bytes to parse. There's also parseFragment for parsing a document fragment, and HtmlParser if you want more low level control.