tinymce.html.DomParser
This class parses HTML code into a DOM like structure of nodes it will remove redundant whitespace and make sure that the node tree is valid according to the specified schema. So for example: <p>a<p>b</p>c</p> will become <p>a</p><p>b</p><p>c</p>
Examples
var parser = new tinymce.html.DomParser({validate: true}, schema);
var rootNode = parser.parse('<h1>content</h1>');
Summary
Methods
Name | Summary | Defined by |
---|---|---|
Adds a attribute filter function to the parser, the parser will collect nodes that has the specified attributes and then execute the callback once it has finished parsing the document. |
||
Adds a node filter function to the parser, the parser will collect the specified nodes by name and then execute the callback once it has finished parsing the document. |
||
Runs the specified node though the element and attributes filters. |
||
Parses the specified HTML string into a DOM like node tree and returns the result. |
Methods
addAttributeFilter()
addAttributeFilter(name: String, callback: function)
Adds a attribute filter function to the parser, the parser will collect nodes that has the specified attributes and then execute the callback once it has finished parsing the document.
addNodeFilter()
addNodeFilter(callback: function)
Adds a node filter function to the parser, the parser will collect the specified nodes by name and then execute the callback once it has finished parsing the document.
filterNode()
filterNode(node: tinymce.html.Node): tinymce.html.Node
Runs the specified node though the element and attributes filters.
Parameters
-
node (Node)
- the node to run filters on.