0 results found

tinymce.dom.Serializer

Contribute to this page
Namespacetinymce.dom
ClassSerializer

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

MethodDefined 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

EventDefined 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

Serializer

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

Parameters

ParamDetail
settings:ObjectSerializer settings object.
dom:DOMUtilsDOMUtils instance reference.
schema:SchemaOptional schema reference.

addAttributeFilter

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

ParamDetail
callback:functionCallback function to execute once it has collected nodes.

Example

addNodeFilter

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

ParamDetail
callback:functionCallback function to execute once it has collected nodes.

Example

addRules

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

ParamDetail
rules:StringValid elements rules string to add to schema.

serialize

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

Parameters

ParamDetail
node:DOMNodeDOM node to serialize.
args:ObjectArguments option that gets passed to event handlers.

setRules

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

ParamDetail
rules:StringValid elements rules string.

Event details

onPostProcess

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

Parameters

ParamDetail
sender:EditorEditor instance.
obj:ObjectPreProcess object.

onPreProcess

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

ParamDetail
sender:Serializerobject/Serializer instance that is serializing an element.
args:ObjectObject containing things like the current node.

Example

onPreProcess

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

ParamDetail
sender:Serializerobject/Serializer instance that is serializing an element.
args:ObjectObject containing things like the current contents.

Example

onPreProcess

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

Parameters

ParamDetail
sender:EditorEditor instance.
obj:ObjectPreProcess object.

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.