pub struct Options {
pub scripting: bool,
pub budget: Option<Duration>,
pub errors: bool,
pub spans: bool,
pub max_depth: Option<usize>,
pub declarative_shadow_roots: Option<bool>,
}Expand description
How to parse.
Fields§
§scripting: boolAs a browser with JavaScript on: <noscript> holds raw text.
budget: Option<Duration>Give up after this long. Some inputs are slow by design (the spec
makes deeply misnested markup cost more), so a crawler parsing
pages it doesn’t control should set one. The clock is read every
4,096 tokenizer steps, so a small input finishes even with
Duration::ZERO: the budget bounds slow parses, not fast ones.
errors: boolCollect the parse errors, for Document::errors. The page is
parsed the same either way; this only keeps the errors, and takes
the tokenizer’s slower path through tags to find them all.
spans: boolRecord where each node and attribute was written, for
Document::span, Document::end_span,
Document::attr_span and Document::line_col. Off, the parse
is as fast as ever; on, it keeps a few bytes more per node.
max_depth: Option<usize>Keep the tree at most this deep, as Chromium does at 512: once more
elements are open than this, a node goes beside the current one
instead of inside it. Only the tree gets flatter; the parse goes on
as before, and every element is still there. None is no limit.
declarative_shadow_roots: Option<bool>Whether a <template shadowrootmode> attaches a shadow root to the
element it’s in, the document’s “allow declarative shadow roots”.
None is the HTML Standard’s default: on for a document, as a
browser parses a page, and off for a fragment, as innerHTML
parses one; Some(true) for a fragment is setHTMLUnsafe. Off, the
template is an ordinary one. In a fragment the context element is
never the host: it isn’t in the result.