goog.editor.node
Functions
findHighestMatchingAncestor( node, hasProperty ) → (Node|null)
(Node|null)
Search ancestor nodes using a predicate function and returns the topmost ancestor in the chain of consecutive ancestors that satisfies the condition.
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
|
findInChildren( parent, hasProperty ) → (number|null)
(number|null)
Search child nodes using a predicate function and return the first node that satisfies the condition.
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
|
findTopMostEditableAncestor( node, criteria ) → (Node|null)
(Node|null)
Finds the top-most DOM node inside an editable field that is an ancestor (or self) of a given DOM node and meets the specified criteria.
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
|
getFirstChild( parent ) → (Node|null)
(Node|null)
Version of firstChild that skips nodes that are entirely whitespace and comments.
Parameters |
| ||||
---|---|---|---|---|---|
Returns |
|
getLastChild( parent ) → (Node|null)
(Node|null)
Version of lastChild that skips nodes that are entirely whitespace or comments. (Normally lastChild is a property of all DOM nodes that gives the last of the nodes contained directly in the reference node.)
Parameters |
| ||||
---|---|---|---|---|---|
Returns |
|
getLeftMostLeaf( parent ) → (Node|null)
(Node|null)
Get the left-most non-ignorable leaf node of the given node.
Parameters |
| ||||
---|---|---|---|---|---|
Returns |
|
getLength( node ) → number
number
Returns the length of the text in node if it is a text node, or the number of children of the node, if it is an element. Useful for range-manipulation code where you need to know the offset for the right side of the node.
Parameters |
| ||||
---|---|---|---|---|---|
Returns |
|
getNextSibling( sibling ) → (Node|null)
(Node|null)
Version of nextSibling that skips nodes that are entirely whitespace or comments.
Parameters |
| ||||
---|---|---|---|---|---|
Returns |
|
getPreviousSibling( sibling ) → (Node|null)
(Node|null)
Version of previoussibling that skips nodes that are entirely whitespace or comments. (Normally previousSibling is a property of all DOM nodes that gives the sibling node, the node that is a child of the same parent, that occurs immediately before the reference node.)
Parameters |
| ||||
---|---|---|---|---|---|
Returns |
|
getRightMostLeaf( parent ) → (Node|null)
(Node|null)
Get the right-most non-ignorable leaf node of the given node.
Parameters |
| ||||
---|---|---|---|---|---|
Returns |
|
isAllNonNbspWhiteSpace( textNode ) → boolean
boolean
Determine whether a node's text content is entirely whitespace.
Parameters |
| ||||
---|---|---|---|---|---|
Returns |
|
isBlockTag( node ) → boolean
boolean
Checks if node is a block-level html element. The display css property is ignored.
Parameters |
| ||||
---|---|---|---|---|---|
Returns |
|
isEditable( node ) → boolean
boolean
Checks if a node is inside an editable container.
Parameters |
| ||||
---|---|---|---|---|---|
Returns |
|
isEditableContainer( element ) → boolean
boolean
Checks if an element is a top-level editable container (meaning that it itself is not editable, but all its child nodes are editable).
Parameters |
| ||||
---|---|---|---|---|---|
Returns |
|
isEmpty( node, opt_prohibitSingleNbsp ) → boolean
boolean
Returns true if the node contains only whitespace and is not and does not contain any images, iframes or embed tags.
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
|
isImportant( node ) → boolean
boolean
Determine if a node should be returned by the iterator functions.
Parameters |
| ||||
---|---|---|---|---|---|
Returns |
|
isStandardsMode( node ) → boolean
boolean
Check if the node is in a standards mode document.
Parameters |
| ||||
---|---|---|---|---|---|
Returns |
|
replaceInnerHtml( node, html ) → void
void
Replaces the innerHTML of a node.
IE has serious problems if you try to set innerHTML of an editable node with any selection. Early versions of IE tear up the old internal tree storage, to help avoid ref-counting loops. But this sometimes leaves the selection object in a bad state and leads to segfaults.
Removing the nodes first prevents IE from tearing them up. This is not strictly necessary in nodes that do not have the selection. You should always use this function when setting innerHTML inside of a field.
Parameters |
|
---|
skipEmptyTextNodes( node ) → (Node|null)
(Node|null)
Skips siblings of a node that are empty text nodes.
Parameters |
| ||||
---|---|---|---|---|---|
Returns |
|
splitDomTreeAt( currentNode, opt_secondHalf, opt_root ) → Node
Node
Splits off a subtree.
Parameters |
| ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
|
transferChildren( newNode, oldNode ) → void
void
Appends all of oldNode's children to newNode. This removes all children from oldNode and appends them to newNode. oldNode is left with no children.
warning Deprecated | Use goog.dom.append directly instead. |
---|
Parameters |
|
---|