commonAncestorContainer
Summary
Returns the deepest node in which two boundary points exist.
Property of dom/Rangedom/Range
Syntax
Note: This property is read-only.
var rangeAcestor = range.commonAncestorContainer;
Return Value
Returns an object of type DOM NodeDOM Node
Node that contains both the Range.startContainer and Range.endContainer nodes.
Examples
var range = document.createRange();
range.setStart(startNode,startOffset);
range.setEnd(endNode,endOffset);
rangeAncestor = range.commonAncestorContainer;
Syntax
rangeAncestor = range.commonAncestorContainer;
Standards information
Related specifications
- DOM
- Living Standard
Attributions
Mozilla Developer Network : [Range.commonAncestorContainer Article]
Microsoft Developer Network: [commonAncestorContainer Property Article]