tinymce.dom.Serializer

Namespace tinymce.dom
Class Serializer
This class is used to serialize DOM trees into a string. Consult the TinyMCE Wiki API for more details and examples on how to use this class.

Public Methods

Method Defined By
Serializer(settings:Object, dom:DOMUtils, schema:Schema)
Constucts a new DOM serializer class.
Serializer
addAttributeFilter(callback:function):void
Adds a attribute filter function to the parser used by the serializer, the parser will collect nodes that has the specif...
Serializer
addNodeFilter(callback:function):void
Adds a node filter function to the parser used by the serializer, the parser will collect the specified nodes by name an...
Serializer
addRules(rules:String):void
Adds valid elements rules to the serializers schema instance this enables you to specify things like what elements shoul...
Serializer
serialize(node:DOMNode, args:Object):void
Serializes the specified browser DOM node into a HTML string.
Serializer
setRules(rules:String):void
Sets the valid elements rules to the serializers schema instance this enables you to specify things like what elements s...
Serializer

Public Events

Event Defined By
onPostProcess(sender:Editor, obj:Object)
Fires when the Serializer does a postProcess on the contents.
Serializer
onPreProcess(sender:Serializer, args:Object)
This event gets executed before a HTML fragment gets serialized into a HTML string.
Serializer
onPreProcess(sender:Serializer, args:Object)
This event gets executed after a HTML fragment has been serialized into a HTML string.
Serializer
onPreProcess(sender:Editor, obj:Object)
Fires when the Serializer does a preProcess on the contents.
Serializer

Method details

Serializerconstructor

public function Serializer(settings:Object, dom:DOMUtils, schema:Schema)
Constucts a new DOM serializer class.

Parameters

settings:Object Serializer settings object.
dom:DOMUtils DOMUtils instance reference.
schema:Schema Optional schema reference.

addAttributeFiltermethod

public function addAttributeFilter(callback:function):void
Adds a attribute filter function to the parser used by the serializer, the parser will collect nodes that has the specified attributes and then execute the callback ones it has finished parsing the document.

Parameters

callback:function Callback function to execute once it has collected nodes.

Example

addNodeFiltermethod

public function addNodeFilter(callback:function):void
Adds a node filter function to the parser used by the serializer, the parser will collect the specified nodes by name and then execute the callback ones it has finished parsing the document.

Parameters

callback:function Callback function to execute once it has collected nodes.

Example

addRulesmethod

public function addRules(rules:String):void
Adds valid elements rules to the serializers schema instance this enables you to specify things like what elements should be outputted and what attributes specific elements might have. Consult the Wiki for more details on this format.

Parameters

rules:String Valid elements rules string to add to schema.

serializemethod

public function serialize(node:DOMNode, args:Object):void
Serializes the specified browser DOM node into a HTML string.

Parameters

node:DOMNode DOM node to serialize.
args:Object Arguments option that gets passed to event handlers.

setRulesmethod

public function setRules(rules:String):void
Sets the valid elements rules to the serializers schema instance this enables you to specify things like what elements should be outputted and what attributes specific elements might have. Consult the Wiki for more details on this format.

Parameters

rules:String Valid elements rules string.

Event details

onPostProcessevent

public event onPostProcess(sender:Editor, obj:Object)
Fires when the Serializer does a postProcess on the contents.

Parameters

sender:Editor Editor instance.
obj:Object PreProcess object.

onPreProcessevent

public event onPreProcess(sender:Serializer, args:Object)
This event gets executed before a HTML fragment gets serialized into a HTML string. This event enables you to do modifications to the DOM before the serialization occurs. It's important to know that the element that is getting serialized is cloned so it's not inside a document.

Parameters

sender:Serializer object/Serializer instance that is serializing an element.
args:Object Object containing things like the current node.

Example

onPreProcessevent

public event onPreProcess(sender:Serializer, args:Object)
This event gets executed after a HTML fragment has been serialized into a HTML string. This event enables you to do modifications to the HTML string like regexp replaces etc.

Parameters

sender:Serializer object/Serializer instance that is serializing an element.
args:Object Object containing things like the current contents.

Example

onPreProcessevent

public event onPreProcess(sender:Editor, obj:Object)
Fires when the Serializer does a preProcess on the contents.

Parameters

sender:Editor Editor instance.
obj:Object PreProcess object.