editor.node

Classes


Public Protected Private

Global Functions

goog.editor.node.findHighestMatchingAncestor(nodehasProperty) Node
Search ancestor nodes using a predicate function and returns the topmost ancestor in the chain of consecutive ancestors that satisfies the condition.
Arguments:
node : Node
The node whose ancestors have to be searched.
hasProperty : function(Node): boolean
A function that takes a parent node as a parameter and returns true if it meets the criteria.
Returns: Node  The topmost ancestor or null if no ancestor satisfies the predicate function.
code »
goog.editor.node.findInChildren(parenthasProperty) ?number
Search child nodes using a predicate function and return the first node that satisfies the condition.
Arguments:
parent : Node
The parent node to search.
hasProperty : function(Node):boolean
A function that takes a child node as a parameter and returns true if it meets the criteria.
Returns: ?number  The index of the node found, or null if no node is found.
code »
goog.editor.node.findTopMostEditableAncestor(nodecriteria) Node
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.
Arguments:
node : Node
The DOM node where the search starts.
criteria : function(Node) : boolean
A function that takes a DOM node as a parameter and returns a boolean to indicate whether the node meets the criteria or not.
Returns: Node  The DOM node if found, or null.
code »
goog.editor.node.getChildHelper_(parentisReversed) Node
Internal helper for lastChild/firstChild that skips nodes that are entirely whitespace or comments.
Arguments:
parent : Node
The reference node.
isReversed : boolean
Whether children should be traversed forward or backward.
Returns: Node  The first/last child of sibling that is important according to goog.editor.node.isImportant, or null if no such node exists.
code »
goog.editor.node.getFirstChild(parent) Node
Version of firstChild that skips nodes that are entirely whitespace and comments.
Arguments:
parent : Node
The reference node.
Returns: Node  The first child of sibling that is important according to goog.editor.node.isImportant, or null if no such node exists.
code »
goog.editor.node.getFirstValue_(iterator) *
Utility function that returns the first value from an iterator or null if the iterator is empty.
Arguments:
iterator : goog.iter.Iterator
The iterator to get a value from.
Returns: *  The first value from the iterator.
code »
goog.editor.node.getLastChild(parent) Node
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.)
Arguments:
parent : Node
The reference node.
Returns: Node  The last child of sibling that is important according to goog.editor.node.isImportant, or null if no such node exists.
code »
goog.editor.node.getLeftMostLeaf(parent) Node
Get the left-most non-ignorable leaf node of the given node.
Arguments:
parent : Node
The parent ndoe.
Returns: Node  The left-most non-ignorable leaf node.
code »
goog.editor.node.getLength(node) 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.
Arguments:
node : Node
The node to get the length of.
Returns: number  The length of the node.
code »
goog.editor.node.getNextSibling(sibling) Node
Version of nextSibling that skips nodes that are entirely whitespace or comments.
Arguments:
sibling : Node
The reference node.
Returns: Node  The closest next sibling to sibling that is important according to goog.editor.node.isImportant, or null if no such node exists.
code »
goog.editor.node.getPreviousSibling(sibling) Node
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.)
Arguments:
sibling : Node
The reference node.
Returns: Node  The closest previous sibling to sibling that is important according to goog.editor.node.isImportant, or null if no such node exists.
code »
goog.editor.node.getRightMostLeaf(parent) Node
Get the right-most non-ignorable leaf node of the given node.
Arguments:
parent : Node
The parent ndoe.
Returns: Node  The right-most non-ignorable leaf node.
code »
goog.editor.node.getSecondHalfOfNode_(nodestartNodefirstChild) !Node
Creates a clone of node, moving all children after startNode to it. When firstChild is not null or undefined, it is also appended to the clone as the first child.
Arguments:
node : !Node
The node to clone.
startNode : !Node
All siblings after this node will be moved to the clone.
firstChild : Node | undefined
The first child of the new cloned element.
Returns: !Node  The cloned node that now contains the children after startNode.
code »
goog.editor.node.isAllNonNbspWhiteSpace(textNode) boolean
Determine whether a node's text content is entirely whitespace.
Arguments:
textNode : Node
A node implementing the CharacterData interface (i.e., a Text, Comment, or CDATASection node.
Returns: boolean  Whether the text content of node is whitespace, otherwise false.
code »
goog.editor.node.isBlockTag(node) boolean
Checks if node is a block-level html element. The display css property is ignored.
Arguments:
node : Node
The node to test.
Returns: boolean  Whether the node is a block-level node.
code »
goog.editor.node.isEditable(node) boolean
Checks if a node is inside an editable container.
Arguments:
node : Node
The node to test.
Returns: boolean  Whether the node is in an editable container.
code »
goog.editor.node.isEditableContainer(element) 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).
Arguments:
element : Node
The element to test.
Returns: boolean  Whether the element is a top-level editable container.
code »
goog.editor.node.isEmpty(nodeopt_prohibitSingleNbsp) boolean
Returns true if the node contains only whitespace and is not and does not contain any images, iframes or embed tags.
Arguments:
node : Node
The node to check.
opt_prohibitSingleNbsp : boolean=
By default, this function treats a single nbsp as empty. Set this to true to treat this case as non-empty.
Returns: boolean  Whether the node contains only whitespace.
code »
goog.editor.node.isImportant(node) boolean
Determine if a node should be returned by the iterator functions.
Arguments:
node : Node
An object implementing the DOM1 Node interface.
Returns: boolean  Whether the node is an element, or a text node that is not all whitespace.
code »
goog.editor.node.isStandardsMode(node) boolean
Check if the node is in a standards mode document.
Arguments:
node : Node
The node to test.
Returns: boolean  Whether the node is in a standards mode document.
code »
goog.editor.node.replaceInnerHtml(nodehtml)
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.
Arguments:
node : Node
A node.
html : string
The innerHTML to set on the node.
code »
goog.editor.node.skipEmptyTextNodes(node) Node
Skips siblings of a node that are empty text nodes.
Arguments:
node : Node
A node. May be null.
Returns: Node  The node or the first sibling of the node that is not an empty text node. May be null.
code »
goog.editor.node.splitDomTreeAt(currentNodeopt_secondHalfopt_root) !Node
Splits off a subtree.
Arguments:
currentNode : !Node
The starting splitting point.
opt_secondHalf : Node=
The initial leftmost leaf the new subtree. If null, siblings after currentNode will be placed in the subtree, but no additional node will be.
opt_root : Node=
The top of the tree where splitting stops at.
Returns: !Node  The new subtree.
code »
goog.editor.node.transferChildren(newNodeoldNode)
Use goog.dom.append directly instead. 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.
Arguments:
newNode : !Node
Node to transfer children to.
oldNode : Node
Node to transfer children from.
code »

Global Properties

goog.editor.node.BLOCK_TAG_NAMES_ :
Names of all block-level tags
Code »
goog.editor.node.NON_EMPTY_TAGS_ :
Names of tags that have intrinsic content. TODO(robbyw): What about object, br, input, textarea, button, isindex, hr, keygen, select, table, tr, td?
Code »

Package editor

Package Reference