Interface IRange
- Namespace
- AngleSharp.Dom
- Assembly
- AngleSharp.dll
The Range interface represents a fragment of a document that can contain nodes and parts of text nodes in a given document.
[DomName("Range")]
public interface IRange
- Extension Methods
Properties
CommonAncestor
Gets the common ancestor node of the contained range.
[DomName("commonAncestorContainer")]
INode CommonAncestor { get; }
Property Value
End
Gets the offset of the EndContainer in the document.
[DomName("endOffset")]
int End { get; }
Property Value
Head
Gets the node that starts the container.
[DomName("startContainer")]
INode Head { get; }
Property Value
IsCollapsed
Gets a value that indicates if the representation is collapsed.
[DomName("collapsed")]
bool IsCollapsed { get; }
Property Value
Start
Gets the offset of the StartContainer in the document.
[DomName("startOffset")]
int Start { get; }
Property Value
Tail
Gets the node that ends the container.
[DomName("endContainer")]
INode Tail { get; }
Property Value
Methods
ClearContent()
Clears the contained nodes.
[DomName("deleteContents")]
void ClearContent()
Clone()
Creates a copy of this range.
[DomName("cloneRange")]
IRange Clone()
Returns
- IRange
The copy representing the same range.
Collapse(bool)
Collapses the range to a single level.
[DomName("collapse")]
void Collapse(bool toStart)
Parameters
toStart
boolDetermines if only the first level should be selected.
CompareBoundaryTo(RangeType, IRange)
Compares the boundary points of the range.
[DomName("compareBoundaryPoints")]
RangePosition CompareBoundaryTo(RangeType how, IRange sourceRange)
Parameters
how
RangeTypeDetermines how these points should be compared.
sourceRange
IRangeThe range of the other boundary points.
Returns
- RangePosition
A relative position.
CompareTo(INode, int)
Compares the node to the given offset and returns the relative position.
[DomName("comparePoint")]
RangePosition CompareTo(INode node, int offset)
Parameters
Returns
- RangePosition
The relative position in the range.
Contains(INode, int)
Checks if the given node is within this range by using a offset.
[DomName("isPointInRange")]
bool Contains(INode node, int offset)
Parameters
Returns
- bool
True if the point is within the range, otherwise false.
CopyContent()
Creates a document fragement of the contained nodes.
[DomName("cloneContents")]
IDocumentFragment CopyContent()
Returns
- IDocumentFragment
The created document fragment.
Detach()
Detaches the range from the DOM tree.
[DomName("detach")]
void Detach()
EndAfter(INode)
Selects the end of the given range by using an exclusive reference node.
[DomName("setEndAfter")]
void EndAfter(INode refNode)
Parameters
refNode
INodeThe referenced node.
EndBefore(INode)
Selects the end of the given range by using an inclusive reference node.
[DomName("setEndBefore")]
void EndBefore(INode refNode)
Parameters
refNode
INodeThe reference node to use.
EndWith(INode, int)
Selects the end of the given range by using the given reference node and a relative offset.
[DomName("setEnd")]
void EndWith(INode refNode, int offset)
Parameters
ExtractContent()
Clears the node representation and returns a document fragment with the originally contained nodes.
[DomName("extractContents")]
IDocumentFragment ExtractContent()
Returns
- IDocumentFragment
The document fragment containing the nodes.
Insert(INode)
Inserts a node into the range.
[DomName("insertNode")]
void Insert(INode node)
Parameters
node
INodeThe node to include.
Intersects(INode)
Checks if the given node is contained in this range.
[DomName("intersectsNode")]
bool Intersects(INode node)
Parameters
node
INodeThe node to check for.
Returns
- bool
True if the node is within the range, otherwise false.
Select(INode)
Selects the contained node.
[DomName("selectNode")]
void Select(INode refNode)
Parameters
refNode
INodeThe node to use.
SelectContent(INode)
Selects the contained nodes by taking a reference node as origin.
[DomName("selectNodeContents")]
void SelectContent(INode refNode)
Parameters
refNode
INodeThe reference node.
StartAfter(INode)
Selects the start of the given range by using an exclusive reference node.
[DomName("setStartAfter")]
void StartAfter(INode refNode)
Parameters
refNode
INodeThe reference node to use.
StartBefore(INode)
Selects the start of the given range by using an inclusive reference node.
[DomName("setStartBefore")]
void StartBefore(INode refNode)
Parameters
refNode
INodeThe reference node to use.
StartWith(INode, int)
Selects the start of the given range by using the given reference node and a relative offset.
[DomName("setStart")]
void StartWith(INode refNode, int offset)
Parameters
Surround(INode)
Includes the given node with its siblings in the range.
[DomName("surroundContents")]
void Surround(INode newParent)
Parameters
newParent
INodeThe range to surround.