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.
public sealed class Highlight : IEnumerable<AbstractRange>, IReadOnlyCollection<AbstractRange>, IEnumerableConstructors
| Name | Description |
|---|---|
| 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.csCreates 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
| Name | Description |
|---|---|
| Count | Gets the number of ranges. |
| Priority | 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. |
| Type | The semantic of the highlight, for the assistive technologies (https://drafts.csswg.org/css-highlight-api-1/#dom-highlight-type). |
Count
Highlights.csPriority
Highlights.csThe 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; }Type
Highlights.csThe 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
| Name | Description |
|---|---|
| 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.csClear()
Highlights.csRemoves all the ranges.
public void Clear()Delete(AbstractRange)
Highlights.csRemoves a range. Returns whether the highlight contained the range.
public bool Delete(AbstractRange range)GetEnumerator()
Highlights.csEnumerates the ranges, including the ranges added during the enumeration.
public IEnumerator<AbstractRange> GetEnumerator()Returns
Has(AbstractRange)
Highlights.csReturns whether the highlight contains the range.
public bool Has(AbstractRange range)