TOC PREV NEXT INDEX

domref



commonAncestorContainer


Returns the deepest Node that contains the startContainer and endContainer Nodes.

Syntax

rangeAncestor = range.commonAncestorContainer;
 

Parameters

rangeAncestor is a Node of type Document, DocumentFragment, or Attr

Example

range = document.createRange();
 
range.setStart(startNode,startOffset);
 
range.setEnd(endNode,endOffset);
 
rangeAncestor = range.commonAncestorContainer;
 

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.

Specification:

commonAncestorContainer


Netscape Communications
http://developer.netscape.com
TOC PREV NEXT INDEX