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());

Summary

Methods

Name Summary Defined by

cdata()

Writes a comment node such as <!-- Comment -->.

Writer

doctype()

Writes a doctype node such as <!DOCTYPE data>.

Writer

end()

Writes the a end element such as </p>.

Writer

getContent()

Returns the contents that got serialized.

Writer

pi()

Writes a PI node such as <?xml attr="value" ?>.

Writer

reset()

Resets the internal buffer if one wants to reuse the writer.

Writer

start()

Writes the a start element such as <p id="a">.

Writer

text()

Writes a text node.

Writer

Methods

cdata()

cdata(text: String)

Writes a comment node such as <!-- Comment -->.

Parameters

  • text (String) - String to write out inside the comment.


doctype()

doctype(text: String)

Writes a doctype node such as <!DOCTYPE data>.

Parameters

  • text (String) - String to write out inside the doctype.


end()

end(name: String)

Writes the a end element such as </p>.

Parameters

  • name (String) - Name of the element.


getContent()

getContent(): String

Returns the contents that got serialized.

Return value

  • String - HTML contents that got written down.


pi()

pi(name: String, text: String)

Writes a PI node such as <?xml attr="value" ?>.

Parameters

  • name (String) - Name of the pi.

  • text (String) - String to write out inside the pi.


reset()

reset()

Resets the internal buffer if one wants to reuse the writer.


start()

start(name: String, attrs: Array, empty: Boolean)

Writes the a start element such as <p id="a">.

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()

text(text: String, raw: Boolean)

Writes a text node.

Parameters

  • text (String) - String to write out.

  • raw (Boolean) - Optional raw state if true the contents wont get encoded.