@@ -26,8 +26,10 @@ import 'src/tokenizer.dart';
2626import 'src/treebuilder.dart' ;
2727import 'src/utils.dart' ;
2828
29- /// Parse the [input] html5 document into a tree. The [input] can be
30- /// a [String] , [List<int>] of bytes or an [HtmlTokenizer] .
29+ /// Parse an html5 document into a tree.
30+ ///
31+ /// The [input] can be a `String` , a `List<int>` of bytes, or an
32+ /// [HtmlTokenizer] .
3133///
3234/// If [input] is not a [HtmlTokenizer] , you can optionally specify the file's
3335/// [encoding] , which must be a string. If specified that encoding will be
@@ -44,9 +46,12 @@ Document parse(dynamic input,
4446 return p.parse ();
4547}
4648
47- /// Parse the [input] html5 document fragment into a tree. The [input] can be
48- /// a [String] , [List<int>] of bytes or an [HtmlTokenizer] . The [container]
49- /// element can optionally be specified, otherwise it defaults to "div".
49+ /// Parse an html5 document fragment into a tree.
50+ ///
51+ /// The [input] can be a `String` , a `List<int>` of bytes, or an
52+ /// [HtmlTokenizer] .
53+ /// The [container] element can optionally be specified, otherwise it defaults
54+ /// to "div".
5055///
5156/// If [input] is not a [HtmlTokenizer] , you can optionally specify the file's
5257/// [encoding] , which must be a string. If specified, that encoding will be used,
@@ -126,8 +131,13 @@ class HtmlParser {
126131 late final _afterAfterBodyPhase = AfterAfterBodyPhase (this );
127132 late final _afterAfterFramesetPhase = AfterAfterFramesetPhase (this );
128133
129- /// Create an HtmlParser and configure the [tree] builder and [strict] mode.
130- /// The [input] can be a [String] , [List<int>] of bytes or an [HtmlTokenizer] .
134+ /// Create and configure an HtmlParser.
135+ ///
136+ /// The [input] can be a `String` , a `List<int>` of bytes, or an
137+ /// [HtmlTokenizer] .
138+ ///
139+ /// The [strict] , [tree] builder, and [generateSpans] arguments configure
140+ /// behavior for any type of input.
131141 ///
132142 /// If [input] is not a [HtmlTokenizer] , you can specify a few more arguments.
133143 ///
@@ -141,16 +151,17 @@ class HtmlParser {
141151 /// automatic conversion of element and attribute names to lower case. Note
142152 /// that standard way to parse HTML is to lowercase, which is what the browser
143153 /// DOM will do if you request `Element.outerHTML` , for example.
144- HtmlParser (dynamic input,
145- {String ? encoding,
146- bool parseMeta = true ,
147- bool lowercaseElementName = true ,
148- bool lowercaseAttrName = true ,
149- this .strict = false ,
150- this .generateSpans = false ,
151- String ? sourceUrl,
152- TreeBuilder ? tree})
153- : tree = tree ?? TreeBuilder (true ),
154+ HtmlParser (
155+ dynamic input, {
156+ TreeBuilder ? tree,
157+ this .strict = false ,
158+ this .generateSpans = false ,
159+ String ? encoding,
160+ bool parseMeta = true ,
161+ bool lowercaseElementName = true ,
162+ bool lowercaseAttrName = true ,
163+ String ? sourceUrl,
164+ }) : tree = tree ?? TreeBuilder (true ),
154165 tokenizer = input is HtmlTokenizer
155166 ? input
156167 : HtmlTokenizer (input,
@@ -166,6 +177,7 @@ class HtmlParser {
166177 bool get innerHTMLMode => innerHTML != null ;
167178
168179 /// Parse an html5 document into a tree.
180+ ///
169181 /// After parsing, [errors] will be populated with parse errors, if any.
170182 Document parse () {
171183 innerHTML = null ;
@@ -174,6 +186,7 @@ class HtmlParser {
174186 }
175187
176188 /// Parse an html5 document fragment into a tree.
189+ ///
177190 /// Pass a [container] to change the type of the containing element.
178191 /// After parsing, [errors] will be populated with parse errors, if any.
179192 DocumentFragment parseFragment ([String container = 'div' ]) {
0 commit comments