commonAncestorContainer property (Range)
Returns a reference to the deepest node in the DOM hierarchy that contains the entire Range object.
Note: The Range object and its commonAncestorContainer property are supported in Internet Explorer from version 9.In Internet Explorer before version 9 (and in newer ones as well), the TextRange object provides functionality similar to the Range object. To get the container element of a TextRange object, use the parentElement method.
You can find the related objects in the Supported by objects section below.
This property is read-only.
Reference to the element that contains the entire Range object.
Default: this property has no default value.
Example HTML code 1:
This example illustrates the use of the commonAncestorContainer property:
Did you find this example helpful?
User Contributed Comments