Class CKEDITOR.dom.node
Extends
CKEDITOR.dom.domObject.
Defined in: core/dom/node.js.
Constructor Attributes | Constructor Name and Description |
---|---|
CKEDITOR.dom.node(domNode)
Base class for classes representing DOM nodes.
|
- Fields borrowed from class CKEDITOR.dom.domObject:
- $, removeCustomData
Method Attributes | Method Name and Description |
---|---|
appendTo(element, toStart)
Makes this node a child of another element.
|
|
clone(includeChildren, cloneId)
|
|
getAddress(normalized)
Retrieves a uniquely identifiable tree address for this node.
|
|
getAscendant(reference, includeSelf)
Gets the closest ancestor node of this node, specified by its name.
|
|
getCommonAncestor(node)
|
|
Gets the document containing this element.
|
|
getIndex(normalized)
|
|
getNext(evaluator)
Gets the node that follows this element in its parent's child list.
|
|
getNextSourceNode(startFromSibling, nodeType, guard)
|
|
Gets the parent element for this node.
|
|
getParents(closerFirst)
|
|
getPosition(otherNode)
|
|
getPrevious(evaluator)
|
|
getPreviousSourceNode(startFromSibling, nodeType, guard)
|
|
hasAscendant(name, includeSelf)
|
|
hasNext()
|
|
insertAfter(node)
Inserts this element after a node.
|
|
insertBefore(node)
Inserts this element before a node.
|
|
insertBeforeMe(node)
|
|
Checks if this node is read-only (should not be changed).
|
|
ltrim()
|
|
move(target, toStart)
|
|
remove(preserveChildren)
Removes this node from the document DOM.
|
|
replace(nodeToReplace)
|
|
rtrim()
|
|
trim()
|
- Methods borrowed from class CKEDITOR.dom.domObject:
- clearCustomData, equals, getCustomData, getPrivate, getUniqueId, removeAllListeners, setCustomData
- Methods borrowed from class CKEDITOR.event:
- fire, fireOnce, hasListeners, on, removeListener
Class Detail
CKEDITOR.dom.node(domNode)
Since:
3.0
Base class for classes representing DOM nodes. This constructor may return
an instance of a class that inherits from this class, like
CKEDITOR.dom.element or CKEDITOR.dom.text.
- Parameters:
- {Object} domNode
- A native DOM node.
Method Detail
{CKEDITOR.dom.element}
appendTo(element, toStart)
Since:
3.0
Makes this node a 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 this node will be appended.
- {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 returned is an array of integers, with each integer
indicating a child index of a DOM node, starting from
document.documentElement
.
For example, assuming <body>
is the second child
of <html>
(<head>
being the first),
and we would 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(reference, includeSelf)
Since:
3.6.1
Gets the closest ancestor node of this node, specified by its name.
// Suppose we have the following HTML structure: // <div id="outer"><div id="inner"><p><b>Some text</b></p></div></div> // If node == <b> ascendant = node.getAscendant( 'div' ); // ascendant == <div id="inner"> ascendant = node.getAscendant( 'b' ); // ascendant == null ascendant = node.getAscendant( 'b', true ); // ascendant == <b> ascendant = node.getAscendant( { div: 1, p: 1} ); // Searches for the first 'div' or 'p': ascendant == <div id="inner">
- Parameters:
- {String} reference
- The name of the ancestor node to search or an object with the node names to search for.
- {Boolean} includeSelf Optional
- Whether to include the current node in the search.
- Returns:
- {CKEDITOR.dom.node} The located ancestor node or null if not found.
{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(normalized)
Since:
3.0
NO EXAMPLE AVAILABLE
- Parameters:
- {Undefined} normalized
{CKEDITOR.dom.node}
getNext(evaluator)
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:
- {Function} evaluator
- Filtering the result node.
- 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(closerFirst)
Since:
3.0
NO EXAMPLE AVAILABLE
- Parameters:
- {Undefined} closerFirst
{Undefined}
getPosition(otherNode)
Since:
3.0
NO EXAMPLE AVAILABLE
- Parameters:
- {Undefined} otherNode
{Undefined}
getPrevious(evaluator)
Since:
3.0
NO EXAMPLE AVAILABLE
- Parameters:
- {Undefined} evaluator
{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 node that will precede this element.
- Returns:
- {CKEDITOR.dom.node} The node preceding 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 node that will succeed this element.
- Returns:
- {CKEDITOR.dom.node} The node being inserted.
{Undefined}
insertBeforeMe(node)
Since:
3.0
NO EXAMPLE AVAILABLE
- Parameters:
- {Undefined} node
{Boolean}
isReadOnly()
Since:
3.5
Checks if this node is read-only (should not be changed).
// For the following HTML: // <div contenteditable="false">Some <b>text</b></div> // If "ele" is the above <div> ele.isReadOnly(); // true
- Returns:
- {Boolean}
{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