Highlight Class

A custom highlight (https://drafts.csswg.org/css-highlight-api-1/#highlight): a set of ranges, styled by the ::highlight(name) pseudo-element once the highlight is registered in a HighlightRegistry under that name. It is a setlike<AbstractRange>: the ranges are enumerated in insertion order, and, as for a JavaScript Set, an enumeration sees the changes made while it is in progress.

Implements

Constructors

NameDescription
Highlight(ReadOnlySpan<AbstractRange>)Creates a highlight that contains the ranges (https://drafts.csswg.org/css-highlight-api-1/#dom-highlight-highlight).

Highlight(ReadOnlySpan<AbstractRange>)

Highlights.cs

Creates a highlight that contains the ranges (https://drafts.csswg.org/css-highlight-api-1/#dom-highlight-highlight).

public Highlight(params scoped ReadOnlySpan<AbstractRange> initialRanges)

Properties

NameDescription
CountGets the number of ranges.
PriorityThe priority of the highlight (https://drafts.csswg.org/css-highlight-api-1/#dom-highlight-priority): the highlights with a higher priority are painted over the other ones.
TypeThe semantic of the highlight, for the assistive technologies (https://drafts.csswg.org/css-highlight-api-1/#dom-highlight-type).

Gets the number of ranges.

public int Count { get; }

Property value

int

The priority of the highlight (https://drafts.csswg.org/css-highlight-api-1/#dom-highlight-priority): the highlights with a higher priority are painted over the other ones.

public int Priority { get; set; }

The semantic of the highlight, for the assistive technologies (https://drafts.csswg.org/css-highlight-api-1/#dom-highlight-type).

public HighlightType Type { get; set; }

Methods

NameDescription
Add(AbstractRange)Adds a range.
Clear()Removes all the ranges.
Delete(AbstractRange)Removes a range. Returns whether the highlight contained the range.
GetEnumerator()Enumerates the ranges, including the ranges added during the enumeration.
Has(AbstractRange)Returns whether the highlight contains the range.
System.Collections.IEnumerable.GetEnumerator()

Add(AbstractRange)

Highlights.cs

Adds a range.

public void Add(AbstractRange range)

Parameters

range AbstractRange

Removes all the ranges.

public void Clear()

Delete(AbstractRange)

Highlights.cs

Removes a range. Returns whether the highlight contained the range.

public bool Delete(AbstractRange range)

Parameters

range AbstractRange

Returns

bool

GetEnumerator()

Highlights.cs

Enumerates the ranges, including the ranges added during the enumeration.

public IEnumerator<AbstractRange> GetEnumerator()

Has(AbstractRange)

Highlights.cs

Returns whether the highlight contains the range.

public bool Has(AbstractRange range)

Parameters

range AbstractRange

Returns

bool

System.Collections.IEnumerable.GetEnumerator()

Highlights.cs
IEnumerator IEnumerable.GetEnumerator()

No documentation is available.