Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

DOMParser

A DOM parser represents a strategy for parsing DOM content into a ProseMirror document conforming to a given schema. Its behavior is defined by an array of rules.

class DOMParser {
constructor(schema: Schema, rules: readonly ParseRule[]);
readonly rules: readonly ParseRule[];
readonly schema: Schema;
 
parse(dom: DOMNode, options?: ParseOptions): Node;
parseSlice(dom: DOMNode, options?: ParseOptions): Slice;
 
static fromSchema(schema: Schema): DOMParser;
}

§Constructors

§
new DOMParser(schema: Schema, rules: readonly ParseRule[])
[src]

Create a parser that targets the given schema, using the given parsing rules.

§Properties

§
rules: readonly ParseRule[]
[src]

The set of parse rules that the parser uses, in order of precedence.

§
schema: Schema
[src]

The schema into which the parser parses.

§Methods

§
parse(dom: DOMNode, options?: ParseOptions): Node
[src]

Parse a document from the content of a DOM node.

§
parseSlice(dom: DOMNode, options?: ParseOptions): Slice
[src]

Parses the content of the given DOM node, like parse, and takes the same set of options. But unlike that method, which produces a whole node, this one returns a slice that is open at the sides, meaning that the schema constraints aren't applied to the start of nodes to the left of the input and the end of nodes at the end.

§Static Methods

§
fromSchema(schema: Schema): DOMParser
[src]

Construct a DOM parser using the parsing rules listed in a schema's node specs, reordered by priority.