# CKEditor 3.0 JavaScript API Documentation

Code Index | File Index

## Namespaces

- CKEDITOR
- CKEDITOR.ajax
- CKEDITOR.config
- CKEDITOR.dom
- CKEDITOR.dtd
- CKEDITOR.env
- CKEDITOR.imageCacher
- CKEDITOR.loader
- CKEDITOR.plugins
- CKEDITOR.resourceManager
- CKEDITOR.scriptLoader
- CKEDITOR.skins
- CKEDITOR.test
- CKEDITOR.themes
- CKEDITOR.tools

## Classes

- CKEDITOR.commandDefinition
- CKEDITOR.dialog
- CKEDITOR.dialog.buttonDefinition
- CKEDITOR.dialog.contentDefinition
- CKEDITOR.dialog.contentDefinitionObject
- CKEDITOR.dialog.dialogDefinition
- CKEDITOR.dialog.dialogDefinitionObject
- CKEDITOR.dialog.uiElementDefinition
- CKEDITOR.dialogCommand
- CKEDITOR.dom.document
- CKEDITOR.dom.domObject
- CKEDITOR.dom.element
- CKEDITOR.dom.event
- CKEDITOR.dom.node
- CKEDITOR.dom.selection
- CKEDITOR.dom.text
- CKEDITOR.dom.window
- CKEDITOR.editor
- CKEDITOR.event
- CKEDITOR.eventInfo
- CKEDITOR.focusManager
- CKEDITOR.htmlParser
- CKEDITOR.htmlParser.cdata
- CKEDITOR.htmlParser.comment
- CKEDITOR.htmlParser.element
- CKEDITOR.htmlParser.fragment
- CKEDITOR.htmlParser.text
- CKEDITOR.htmlWriter
- CKEDITOR.keystrokeHandler
- CKEDITOR.pluginDefinition
- CKEDITOR.ui
- CKEDITOR.ui.button
- CKEDITOR.ui.dialog.button
- CKEDITOR.ui.dialog.checkbox
- CKEDITOR.ui.dialog.file
- CKEDITOR.ui.dialog.fileButton
- CKEDITOR.ui.dialog.hbox
- CKEDITOR.ui.dialog.html
- CKEDITOR.ui.dialog.labeledElement
- CKEDITOR.ui.dialog.radio
- CKEDITOR.ui.dialog.select
- CKEDITOR.ui.dialog.textarea
- CKEDITOR.ui.dialog.textInput
- CKEDITOR.ui.dialog.uiElement
- CKEDITOR.ui.dialog.vbox
- CKEDITOR.ui.handlerDefinition
- CKEDITOR.xml

# Class CKEDITOR.dom.node

Extends CKEDITOR.dom.domObject.
Defined in: core/dom/node.js.

Class Summary
Constructor Attributes | Constructor Name and Description
--- | ---
| CKEDITOR.dom.node(domNode) Base class for classes representing DOM nodes.

Fields borrowed from class CKEDITOR.dom.domObject:
  $

Method Summary
Method Attributes | Method Name and Description
--- | ---
| appendTo(element, toStart) Makes this node child of another element.
| clone(includeChildren, cloneId)
| getAddress(normalized) Retrieves a uniquely identifiable tree address for this node.
| getAscendant(name, includeSelf) Gets the closes ancestor node of a specified node name.
| getCommonAncestor(node)
| getDocument() Gets the document containing this element.
| getIndex()
| getNext(ignoreSpaces) Gets the node that follows this element in its parent's child list.
| getNextSourceNode(startFromSibling, nodeType, guard)
| getParent() Gets the parent element for this node.
| getParents()
| getPosition(otherNode)
| getPrevious(ignoreSpaces)
| getPreviousSourceNode(startFromSibling, nodeType, guard)
| hasAscendant(name, includeSelf)
| hasNext()
| hasPrevious()
| insertAfter(node) Inserts this element after a node.
| insertBefore(node) Inserts this element before a node.
| insertBeforeMe(node)
| ltrim()
| move(target, toStart)
| remove(preserveChildren) Removes this node from the document DOM.
| replace(nodeToReplace)
| rtrim()
| trim()

Methods borrowed from class CKEDITOR.dom.domObject:
  equals, getCustomData, getPrivate, setCustomData
Methods borrowed from class CKEDITOR.event:
  fire, fireOnce, hasListeners, implementOn, on, removeListener

Class Detail
CKEDITOR.dom.node(domNode)
Since: 3.0
Base class for classes representing DOM nodes. This constructor may return and instance of classes that inherits this class, like CKEDITOR.dom.element or CKEDITOR.dom.text.

Parameters:
{Object} domNode
  A native DOM node.

See:
  CKEDITOR.dom.element
  CKEDITOR.dom.text

Method Detail
{CKEDITOR.dom.element} appendTo(element, toStart)
Since: 3.0
Makes this node child of another element.

    var p = new CKEDITOR.dom.element( 'p' );
    var strong = new CKEDITOR.dom.element( 'strong' );
    strong.appendTo( p );

    // result: "<p><strong></strong></p>"

Parameters:
{CKEDITOR.dom.element} element
  The target element to which append this node.
{Undefined} toStart

Returns:
  {CKEDITOR.dom.element} The target element.

{Undefined} clone(includeChildren, cloneId)
Since: 3.0

    NO EXAMPLE AVAILABLE

Parameters:
{Undefined} includeChildren
{Undefined} cloneId

{Undefined} getAddress(normalized)
Since: 3.0
Retrieves a uniquely identifiable tree address for this node. The tree address returns is an array of integers, with each integer indicating a child index of a DOM node, starting from document.documentElement. For example, assuming
is the second child from
( being the first), and we'd like to address the third child under the fourth child of body, the tree address returned would be: [1, 3, 2] The tree address cannot be used for finding back the DOM tree node once the DOM tree structure has been modified.

    NO EXAMPLE AVAILABLE

Parameters:
{Undefined} normalized

{CKEDITOR.dom.node} getAscendant(name, includeSelf)
Since: 3.0
Gets the closes ancestor node of a specified node name.

    NO EXAMPLE AVAILABLE

Parameters:
{String} name
  Node name of ancestor node.
{Boolean} includeSelf
  (Optional) Whether to include the current node in the calculation or not.

Returns:
  {CKEDITOR.dom.node} Ancestor node.

{Undefined} getCommonAncestor(node)
Since: 3.0

    NO EXAMPLE AVAILABLE

Parameters:
{Undefined} node

{CKEDITOR.dom.document} getDocument()
Since: 3.0
Gets the document containing this element.

    var element = CKEDITOR.document.getById( 'example' );
    alert( element.getDocument().equals( CKEDITOR.document ) );  // "true"

Returns:
  {CKEDITOR.dom.document} The document.

{Undefined} getIndex()
Since: 3.0

    NO EXAMPLE AVAILABLE

{CKEDITOR.dom.node} getNext(ignoreSpaces)
Since: 3.0
Gets the node that follows this element in its parent's child list.

    var element = CKEDITOR.dom.element.createFromHtml( '<div><b>Example</b> <i>next</i></div>' );
    var first = element.getFirst().getNext();
    alert( first.getName() );  // "i"

Parameters:
{Boolean} ignoreSpaces
  Whether should ignore empty text nodes.

Returns:
  {CKEDITOR.dom.node} The next node or null if not available.

{Undefined} getNextSourceNode(startFromSibling, nodeType, guard)
Since: 3.0

    NO EXAMPLE AVAILABLE

Parameters:
{Undefined} startFromSibling
{Undefined} nodeType
{Undefined} guard

{CKEDITOR.dom.element} getParent()
Since: 3.0
Gets the parent element for this node.

    var node = editor.document.getBody().getFirst();
    var parent = node.getParent();
    alert( node.getName() );  // "body"

Returns:
  {CKEDITOR.dom.element} The parent element.

{Undefined} getParents()
Since: 3.0

    NO EXAMPLE AVAILABLE

{Undefined} getPosition(otherNode)
Since: 3.0

    NO EXAMPLE AVAILABLE

Parameters:
{Undefined} otherNode

{Undefined} getPrevious(ignoreSpaces)
Since: 3.0

    NO EXAMPLE AVAILABLE

Parameters:
{Undefined} ignoreSpaces

{Undefined} getPreviousSourceNode(startFromSibling, nodeType, guard)
Since: 3.0

    NO EXAMPLE AVAILABLE

Parameters:
{Undefined} startFromSibling
{Undefined} nodeType
{Undefined} guard

{Undefined} hasAscendant(name, includeSelf)
Since: 3.0

    NO EXAMPLE AVAILABLE

Parameters:
{Undefined} name
{Undefined} includeSelf

{Undefined} hasNext()
Since: 3.0

    NO EXAMPLE AVAILABLE

{Undefined} hasPrevious()
Since: 3.0

    NO EXAMPLE AVAILABLE

{CKEDITOR.dom.node} insertAfter(node)
Since: 3.0
Inserts this element after a node.

    var em = new CKEDITOR.dom.element( 'em' );
    var strong = new CKEDITOR.dom.element( 'strong' );
    strong.insertAfter( em );

    // result: "<em></em><strong></strong>"

Parameters:
{CKEDITOR.dom.node} node
  The that will preceed this element.

Returns:
  {CKEDITOR.dom.node} The node preceeding this one after insertion.

{CKEDITOR.dom.node} insertBefore(node)
Since: 3.0
Inserts this element before a node.

    var em = new CKEDITOR.dom.element( 'em' );
    var strong = new CKEDITOR.dom.element( 'strong' );
    strong.insertBefore( em );

    // result: "<strong></strong><em></em>"

Parameters:
{CKEDITOR.dom.node} node
  The that will be after this element.

Returns:
  {CKEDITOR.dom.node} The node being inserted.

{Undefined} insertBeforeMe(node)
Since: 3.0

    NO EXAMPLE AVAILABLE

Parameters:
{Undefined} node

{Undefined} ltrim()
Since: 3.0

    NO EXAMPLE AVAILABLE

{Undefined} move(target, toStart)
Since: 3.0

    NO EXAMPLE AVAILABLE

Parameters:
{Undefined} target
{Undefined} toStart

{Undefined} remove(preserveChildren)
Since: 3.0
Removes this node from the document DOM.

    var element = CKEDITOR.dom.element.getById( 'MyElement' );
    element.remove();

Parameters:
{Boolean} preserveChildren Optional
  Indicates that the children elements must remain in the document, removing only the outer tags.

{Undefined} replace(nodeToReplace)
Since: 3.0

    NO EXAMPLE AVAILABLE

Parameters:
{Undefined} nodeToReplace

{Undefined} rtrim()
Since: 3.0

    NO EXAMPLE AVAILABLE

{Undefined} trim()
Since: 3.0

    NO EXAMPLE AVAILABLE

Copyright © 2003-2009, CKSource - Frederico Knabben. All rights reserved.