NOTE: TinyMCE 5 reached End of Support in April 2023. No more bug fixes, security updates, or new features will be introduced to TinyMCE 5. We recommend you upgrade to TinyMCE 6 or consider TinyMCE 5 Long Term Support (LTS) if you need more time.
tinymce.html.Writer
This class is used to write HTML tags out it can be used with the Serializer or the SaxParser.
Examples
var writer = new tinymce.html.Writer({indent: true});
var parser = new tinymce.html.SaxParser(writer).parse('<p><br></p>');
console.log(writer.getContent());
Methods
name | summary | defined by |
---|---|---|
cdata() | Writes a comment node such as . | tinymce.html.Writer |
doctype() | Writes a doctype node such as . | tinymce.html.Writer |
end() | Writes the a end element such as . | tinymce.html.Writer |
getContent() | Returns the contents that got serialized. | tinymce.html.Writer |
pi() | Writes a PI node such as . | tinymce.html.Writer |
reset() | Resets the internal buffer if one wants to reuse the writer. | tinymce.html.Writer |
start() | Writes the a start element such as . | tinymce.html.Writer |
text() | Writes a text node. | tinymce.html.Writer |
Methods
cdata
Writes a comment node such as .
Parameters
- text (String) - String to write out inside the comment.
doctype
Writes a doctype node such as .
Parameters
- text (String) - String to write out inside the doctype.
end
Writes the a end element such as
.Parameters
- name (String) - Name of the element.
getContent
Returns the contents that got serialized.
Return value
- String - HTML contents that got written down.
pi
Writes a PI node such as .
Parameters
- name (String) - Name of the pi.
- text (String) - String to write out inside the pi.
reset
Resets the internal buffer if one wants to reuse the writer.
start
Writes the a start element such as
.
Parameters
- name (String) - Name of the element.
- attrs (Array) - Optional attribute array or undefined if it hasn't any.
- empty (Boolean) - Optional empty state if the tag should end like
.
text
Writes a text node.
Parameters
- text (String) - String to write out.
- raw (Boolean) - Optional raw state if true the contents wont get encoded.
Can't find what you're looking for? Let us know.
Except as otherwise noted, the content of this page is licensed under the Creative Commons BY-NC-SA 3.0 License, and code samples are licensed under the Apache 2.0 License.