tinymce.html.Schema

Namespace tinymce.html
Class Schema
Schema validator class.
Version:3.4

Example

Public Methods

Method Defined By
Schema(settings:Object)
Constructs a new Schema instance.
Schema
addCustomElements(custom_elements:String):void
Adds custom non HTML elements to the schema.
Schema
addValidChildren(valid_children:String):void
Parses a valid children string and adds them to the schema structure.
Schema
addValidElements(valid_elements:String):void
Parses a valid elements string and adds it to the schema.
Schema
Returns a map with block elements.
Schema
getBoolAttrs():Object
Returns a map with boolean attributes.
Schema
Returns an map object of all custom elements.
Schema
getElementRule(name:String):Object
Returns true/false if the specified element is valid or not according to the schema.
Schema
Returns a map with elements that should be treated as contents regardless if it has text content in them or not such as ...
Schema
Returns a map with self closing tags such as .
Schema
Returns a map with short ended elements such as BR or IMG.
Schema
Returns a map with text block elements.
Schema
Returns a map with elements where white space is to be preserved like PRE or SCRIPT.
Schema
isValid(name:String, attr:String):Boolean
Returns true/false if the specified element name and optional attribute is valid according to the schema.
Schema
isValidChild(name:String, child:String):Boolean
Returns true/false if the specified element and it's child is valid or not according to the schema.
Schema
setValidElements(valid_elements:String):void
Parses a valid elements string and sets it to the schema.
Schema

Method details

Schemaconstructor

public function Schema(settings:Object)
Constructs a new Schema instance.

Parameters

settings:Object Name/value settings object.

addCustomElementsmethod

public function addCustomElements(custom_elements:String):void
Adds custom non HTML elements to the schema.

Parameters

custom_elements:String Comma separated list of custom elements to add.

addValidChildrenmethod

public function addValidChildren(valid_children:String):void
Parses a valid children string and adds them to the schema structure. The valid children format is for example: "element[child1|child2]".

Parameters

valid_children:String Valid children elements string to parse

addValidElementsmethod

public function addValidElements(valid_elements:String):void
Parses a valid elements string and adds it to the schema. The valid elements format is for example "element[attr=default|otherattr]". Existing rules will be replaced with the ones specified, so this extends the schema.

Parameters

valid_elements:String String in the valid elements format to be parsed.

getBlockElementsmethod

public function getBlockElements():Object
Returns a map with block elements.

Returns

Object - Name/value lookup map for block elements.

getBoolAttrsmethod

public function getBoolAttrs():Object
Returns a map with boolean attributes.

Returns

Object - Name/value lookup map for boolean attributes.

getCustomElementsmethod

public function getCustomElements():Object
Returns an map object of all custom elements.

Returns

Object - Name/value map object of all custom elements.

getElementRulemethod

public function getElementRule(name:String):Object
Returns true/false if the specified element is valid or not according to the schema.

Parameters

name:String Element name to check for.

Returns

Object - Element object or undefined if the element isn't valid.

getNonEmptyElementsmethod

public function getNonEmptyElements():Object
Returns a map with elements that should be treated as contents regardless if it has text content in them or not such as TD, VIDEO or IMG.

Returns

Object - Name/value lookup map for non empty elements.

getSelfClosingElementsmethod

public function getSelfClosingElements():Object
Returns a map with self closing tags such as
  • .
  • Returns

    Object - Name/value lookup map for self closing tags elements.

    getShortEndedElementsmethod

    public function getShortEndedElements():Object
    Returns a map with short ended elements such as BR or IMG.

    Returns

    Object - Name/value lookup map for short ended elements.

    getTextBlockElementsmethod

    public function getTextBlockElements():Object
    Returns a map with text block elements. Such as: p,h1-h6,div,address

    Returns

    Object - Name/value lookup map for block elements.

    getWhiteSpaceElementsmethod

    public function getWhiteSpaceElements():Object
    Returns a map with elements where white space is to be preserved like PRE or SCRIPT.

    Returns

    Object - Name/value lookup map for white space elements.

    isValidmethod

    public function isValid(name:String, attr:String):Boolean
    Returns true/false if the specified element name and optional attribute is valid according to the schema.

    Parameters

    name:String Name of element to check.
    attr:String Optional attribute name to check for.

    Returns

    Boolean - True/false if the element and attribute is valid.

    isValidChildmethod

    public function isValidChild(name:String, child:String):Boolean
    Returns true/false if the specified element and it's child is valid or not according to the schema.

    Parameters

    name:String Element name to check for.
    child:String Element child to verify.

    Returns

    Boolean - True/false if the element is a valid child of the specified parent.

    setValidElementsmethod

    public function setValidElements(valid_elements:String):void
    Parses a valid elements string and sets it to the schema. The valid elements format is for example "element[attr=default|otherattr]". Existing rules will be replaced with the ones specified, so this extends the schema.

    Parameters

    valid_elements:String String in the valid elements format to be parsed.