DOM:range.commonAncestorContainer
From MDC
Contents |
[edit] Summary
Returns the deepest Node that contains the startContainer and endContainer Nodes.
[edit] Syntax
rangeAncestor = range.commonAncestorContainer;
[edit] Example
range = document.createRange(); range.setStart(startNode,startOffset); range.setEnd(endNode,endOffset); rangeAncestor = range.commonAncestorContainer;
[edit] Notes
Returns the deepest, or further down the document tree, Node that contains both the startContainer and endContainer nodes. Since a Range need not be continuous, and may also partially select Nodes, this is a convenient way to find a Node which encloses a Range.
This property is read-only. To change the ancestor container of a Node, consider using the various methods to set the start and end positions of the Range.