CKEditor 4 Documentation

CKEDITOR.htmlParser.element

Hierarchy

CKEDITOR.htmlParser.node
CKEDITOR.htmlParser.element

Files

A lightweight representation of an HTML element.

Defined By

Properties

CKEDITOR.htmlParser.element
view source
: Objectprivate
CKEDITOR.htmlParser.element
view source
: Object

Stores the attributes defined for this element.

Stores the attributes defined for this element.

CKEDITOR.htmlParser.element
view source
: Array
The nodes that are direct children of this element. ...

The nodes that are direct children of this element.

Defaults to: []

CKEDITOR.htmlParser.element
view source
: String

The element name.

The element name.

CKEDITOR.htmlParser.element
view source
: Numberreadonly
The node type. ...

The node type. This is a constant value set to CKEDITOR.NODE_ELEMENT.

Defaults to: CKEDITOR.NODE_ELEMENT

Defined By

Methods

CKEDITOR.htmlParser.element
view source
new( name, attributes ) : CKEDITOR.htmlParser.element
Creates an element class instance. ...

Creates an element class instance.

Parameters

  • name : String

    The element name.

  • attributes : Object

    An object storing all attributes defined for this element.

Returns

Overrides: CKEDITOR.htmlParser.node.constructor

CKEDITOR.htmlParser.element
view source
( node, [index] )
Adds a node to the element children list. ...

Adds a node to the element children list.

Parameters

CKEDITOR.htmlParser.element
view source
( className )
Adds a class name to the list of classes. ...

Adds a class name to the list of classes.

Available since: 4.4

Parameters

  • className : String

    The class name to be added.

CKEDITOR.htmlParser.element
view source
( ) : CKEDITOR.htmlParser.element
Clones this element. ...

Clones this element.

Returns

CKEDITOR.htmlParser.element
view source
( filter ) : Boolean
Filters this element and its children with the given filter. ...

Filters this element and its children with the given filter.

Available since: 4.1

Parameters

Returns

  • Boolean

    The method returns false when this element has been removed or replaced with another. This information means that filterChildren has to repeat the filter on the current position in parent's children array.

CKEDITOR.htmlParser.element
view source
( filter )
Filters this element's children with the given filter. ...

Filters this element's children with the given filter.

Element's children may only be filtered once by one instance of the filter.

Parameters

CKEDITOR.htmlParser.element
view source
( criteria, [recursive] ) : CKEDITOR.htmlParser.node[]
Searches through the current node children to find nodes matching the criteria. ...

Searches through the current node children to find nodes matching the criteria.

Parameters

  • criteria : String/Function

    Tag name or evaluator function.

  • recursive : Boolean (optional)

    Defaults to: false

Returns

CKEDITOR.htmlParser.element
view source
( callback, [type], [skipRoot] )
Executes a callback on each node (of the given type) in this element. ...

Executes a callback on each node (of the given type) in this element.

// Create a <p> element with foo<b>bar</b>bom as its content.
var elP = CKEDITOR.htmlParser.fragment.fromHtml( 'foo<b>bar</b>bom', 'p' );
elP.forEach( function( node ) {
    console.log( node );
} );
// Will log:
// 1. document fragment,
// 2. <p> element,
// 3. "foo" text node,
// 4. <b> element,
// 5. "bar" text node,
// 6. "bom" text node.

Available since: 4.1

Parameters

  • callback : Function

    Function to be executed on every node. Since 4.3: If callback returned false, the descendants of the current node will be ignored.

    Parameters

  • type : Number (optional)

    Whether the specified callback will be executed only on nodes of this type.

  • skipRoot : Boolean (optional)

    Do not execute callback on this element.

Gets the closest ancestor element of this element which satisfies given condition ...

Gets the closest ancestor element of this element which satisfies given condition

Available since: 4.3

Parameters

  • condition : String/Object/Function

    Name of an ancestor, hash of names or validator function.

Returns

CKEDITOR.htmlParser.element
view source
( condition ) : CKEDITOR.htmlParser.node
Gets this element's first child. ...

Gets this element's first child. If condition is given, this method returns the first child which satisfies that condition.

Available since: 4.3

Parameters

  • condition : String/Object/Function

    Name of a child, a hash of names, or a validator function.

Returns

CKEDITOR.htmlParser.element
view source
( ) : String
Gets this element's inner HTML. ...

Gets this element's inner HTML.

Available since: 4.3

Returns

  • String
Gets this node's index in its parent's children array. ...

Gets this node's index in its parent's children array.

Available since: 4.3

Returns

  • Number
CKEDITOR.htmlParser.element
view source
( ) : String
Gets this element's outer HTML. ...

Gets this element's outer HTML.

Available since: 4.3

Returns

  • String
CKEDITOR.htmlParser.element
view source
( className ) : Boolean
Checkes whether this element has a class name. ...

Checkes whether this element has a class name.

Available since: 4.3

Parameters

  • className : String

    The class name to be checked.

Returns

  • Boolean

    Whether this element has a className.

Insert this node after given one. ...

Insert this node after given one.

Available since: 4.1

Parameters

Insert this node before given one. ...

Insert this node before given one.

Available since: 4.1

Parameters

Remove this node from a tree. ...

Remove this node from a tree.

Available since: 4.1

CKEDITOR.htmlParser.element
view source
( className )
Removes a class name from the list of classes. ...

Removes a class name from the list of classes.

Available since: 4.3

Parameters

  • className : String

    The class name to be removed.

Replace this node with given one. ...

Replace this node with given one.

Available since: 4.1

Parameters

CKEDITOR.htmlParser.element
view source
( )
Replaces this element with its children. ...

Replaces this element with its children.

Available since: 4.1

CKEDITOR.htmlParser.element
view source
( html )
Sets this element's inner HTML. ...

Sets this element's inner HTML.

Available since: 4.3

Parameters

  • html : String
CKEDITOR.htmlParser.element
view source
( index ) : CKEDITOR.htmlParser.element
Splits this element at the given index. ...

Splits this element at the given index.

Available since: 4.3

Parameters

  • index : Number

    Index at which the element will be split — 0 means the beginning, 1 after the first child node, etc.

Returns

Wraps this element with given wrapper. ...

Wraps this element with given wrapper.

Available since: 4.3

Parameters

Returns

CKEDITOR.htmlParser.element
view source
( writer, [filter] )
Sends children of this element to the writer. ...

Sends children of this element to the writer.

Parameters

CKEDITOR.htmlParser.element
view source
( writer, [filter] )
Writes the element HTML to the CKEDITOR.htmlWriter. ...

Writes the element HTML to the CKEDITOR.htmlWriter.

Parameters