Skip to content

Commit a2d0346

Browse files
Custom Highlight methods accept any AbstractRange (mdn#43744)
* fixed AbstractRange instead Range * Fix others * Fix --------- Co-authored-by: Joshua Chen <sidachen2003@gmail.com>
1 parent f3358a1 commit a2d0346

File tree

14 files changed

+27
-26
lines changed

14 files changed

+27
-26
lines changed

files/en-us/web/api/highlight/add/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ spec-urls: https://tc39.es/ecma262/multipage/keyed-collections.html#sec-set.prot
99

1010
{{APIRef("CSS Custom Highlight API")}}
1111

12-
The **`add()`** method of the {{domxref("Highlight")}} interface adds a new {{domxref("Range")}} object to a highlight, to be styled using the {{domxref("css_custom_highlight_api", "CSS Custom Highlight API", "", "nocode")}}.
12+
The **`add()`** method of the {{domxref("Highlight")}} interface adds a new {{domxref("AbstractRange")}} object to a highlight, to be styled using the {{domxref("css_custom_highlight_api", "CSS Custom Highlight API", "", "nocode")}}.
1313

1414
`Highlight` is a {{jsxref("Set")}}-like object, so this is similar to using {{jsxref("Set.add()")}}.
1515

@@ -22,7 +22,7 @@ add(range)
2222
### Parameters
2323

2424
- `range`
25-
- : A {{domxref("Range")}} object to add to the `Highlight`.
25+
- : An {{domxref("AbstractRange")}} object to add to the `Highlight`.
2626

2727
### Return value
2828

files/en-us/web/api/highlight/clear/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ spec-urls: https://tc39.es/ecma262/multipage/keyed-collections.html#sec-set.prot
99

1010
{{APIRef("CSS Custom Highlight API")}}
1111

12-
The **`clear()`** method of the {{domxref("Highlight")}} interface removes all the {{domxref("Range")}} objects from a `Highlight` object.
12+
The **`clear()`** method of the {{domxref("Highlight")}} interface removes all the {{domxref("AbstractRange")}} objects from a `Highlight` object.
1313

1414
`Highlight` is a {{jsxref("Set")}}-like object, so this is similar to using {{jsxref("Set.clear()")}}.
1515

files/en-us/web/api/highlight/delete/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ spec-urls: https://tc39.es/ecma262/multipage/keyed-collections.html#sec-set.prot
99

1010
{{APIRef("CSS Custom Highlight API")}}
1111

12-
The **`delete()`** method of the {{domxref("Highlight")}} interface removes a specified {{domxref("Range")}} object from a `Highlight` object.
12+
The **`delete()`** method of the {{domxref("Highlight")}} interface removes a specified {{domxref("AbstractRange")}} object from a `Highlight` object.
1313

1414
`Highlight` is a {{jsxref("Set")}}-like object, so this is similar to using {{jsxref("Set.delete()")}}.
1515

@@ -22,7 +22,7 @@ delete(range)
2222
### Parameters
2323

2424
- `range`
25-
- : The {{domxref("Range")}} object to remove from the `Highlight`.
25+
- : The {{domxref("AbstractRange")}} object to remove from the `Highlight`.
2626

2727
### Return value
2828

files/en-us/web/api/highlight/entries/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ spec-urls: https://tc39.es/ecma262/multipage/keyed-collections.html#sec-set.prot
99

1010
{{APIRef("CSS Custom Highlight API")}}
1111

12-
The **`entries()`** method of the {{domxref("Highlight")}} interface returns a new [Iterator](/en-US/docs/Web/JavaScript/Guide/Iterators_and_generators) object that contains an array of `[range, range]` for each {{domxref("Range")}} object in the `Highlight` object, in insertion order.
12+
The **`entries()`** method of the {{domxref("Highlight")}} interface returns a new [Iterator](/en-US/docs/Web/JavaScript/Guide/Iterators_and_generators) object that contains an array of `[range, range]` for each {{domxref("AbstractRange")}} object in the `Highlight` object, in insertion order.
1313

1414
`Highlight` is a {{jsxref("Set")}}-like object, so this is similar to using {{jsxref("Set.entries()")}}.
1515

@@ -25,7 +25,7 @@ None.
2525

2626
### Return value
2727

28-
A new iterator object that contains an array of `[range, range]` for each `Range` object in the given `Highlight`, in insertion order.
28+
A new iterator object that contains an array of `[range, range]` for each `AbstractRange` object in the given `Highlight`, in insertion order.
2929

3030
## Examples
3131

files/en-us/web/api/highlight/foreach/index.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ spec-urls: https://tc39.es/ecma262/multipage/keyed-collections.html#sec-set.prot
99

1010
{{APIRef("CSS Custom Highlight API")}}
1111

12-
The **`forEach()`** method of the {{domxref("Highlight")}} interface executes a provided function once for each {{domxref("Range")}} object in the `Highlight` object, in insertion order.
12+
The **`forEach()`** method of the {{domxref("Highlight")}} interface executes a provided function once for each {{domxref("AbstractRange")}} object in the `Highlight` object, in insertion order.
1313

1414
`Highlight` is a {{jsxref("Set")}}-like object, so this is similar to using {{jsxref("Set.forEach()")}}.
1515

@@ -23,9 +23,9 @@ forEach(callbackFn, thisArg)
2323
### Parameters
2424

2525
- `callback`
26-
- : Function to execute for each `Range` object, taking three arguments:
26+
- : Function to execute for each `AbstractRange` object, taking three arguments:
2727
- `range`, `key`
28-
- : The current `Range` object being processed in the `Highlight`. As there are no
28+
- : The current `AbstractRange` object being processed in the `Highlight`. As there are no
2929
keys in `Highlight`, the `range` is passed for both arguments.
3030
- `highlight`
3131
- : The `Highlight` object which `forEach()` was called upon.

files/en-us/web/api/highlight/has/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ spec-urls: https://tc39.es/ecma262/multipage/keyed-collections.html#sec-set.prot
99

1010
{{APIRef("CSS Custom Highlight API")}}
1111

12-
The **`has()`** method of the {{domxref("Highlight")}} interface returns a boolean indicating whether a {{domxref("Range")}} object exists in a `Highlight` object or not.
12+
The **`has()`** method of the {{domxref("Highlight")}} interface returns a boolean indicating whether an {{domxref("AbstractRange")}} object exists in a `Highlight` object or not.
1313

1414
`Highlight` is a {{jsxref("Set")}}-like object, so this is similar to using {{jsxref("Set.has()")}}.
1515

@@ -22,7 +22,7 @@ has(range)
2222
### Parameters
2323

2424
- `range`
25-
- : The `Range` object to test for presence in the `Highlight` object.
25+
- : The `AbstractRange` object to test for presence in the `Highlight` object.
2626

2727
### Return value
2828

files/en-us/web/api/highlight/highlight/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ browser-compat: api.Highlight.Highlight
99
{{APIRef("CSS Custom Highlight API")}}
1010

1111
The **`Highlight()`** constructor returns a newly created
12-
{{domxref("Highlight")}} object which can hold a collection of {{domxref("Range")}} objects to be styled using the {{domxref("css_custom_highlight_api", "CSS Custom Highlight API", "", "nocode")}}.
12+
{{domxref("Highlight")}} object which can hold a collection of {{domxref("AbstractRange")}} objects to be styled using the {{domxref("css_custom_highlight_api", "CSS Custom Highlight API", "", "nocode")}}.
1313

1414
## Syntax
1515

@@ -22,7 +22,7 @@ new Highlight(range1, range2, /* …, */ rangeN)
2222
### Parameters
2323

2424
- `range1`, …, `rangeN` {{optional_inline}}
25-
- : One or more initial {{domxref("Range")}} objects to add in the new highlight.
25+
- : One or more initial {{domxref("AbstractRange")}} objects to add in the new highlight.
2626

2727
### Return value
2828

files/en-us/web/api/highlight/index.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ browser-compat: api.Highlight
77

88
{{APIRef("CSS Custom Highlight API")}}
99

10-
The **`Highlight`** interface of the [CSS Custom Highlight API](/en-US/docs/Web/API/CSS_Custom_Highlight_API) is used to represent a collection of {{domxref("Range")}} instances to be styled using the API.
10+
The **`Highlight`** interface of the [CSS Custom Highlight API](/en-US/docs/Web/API/CSS_Custom_Highlight_API) is used to represent a collection of {{domxref("AbstractRange")}} instances to be styled using the API.
1111

12-
To style arbitrary ranges in a page, instantiate a new `Highlight` object, add one or more `Range` objects to it, and register it using the {{domxref("HighlightRegistry")}}.
12+
To style arbitrary ranges in a page, instantiate a new `Highlight` object, add one or more `AbstractRange` objects to it, and register it using the {{domxref("HighlightRegistry")}}.
1313

14-
A `Highlight` instance is a [`Set`-like object](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set#set-like_browser_apis) that can hold one or more `Range` objects.
14+
A `Highlight` instance is a [`Set`-like object](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set#set-like_browser_apis) that can hold one or more `AbstractRange` objects.
1515

1616
{{InheritanceDiagram}}
1717

files/en-us/web/api/highlight/keys/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ None.
2525

2626
### Return value
2727

28-
A new iterator object containing each `Range` object in the given `Highlight`, in insertion order.
28+
A new iterator object containing each `AbstractRange` object in the given `Highlight`, in insertion order.
2929

3030
## Specifications
3131

files/en-us/web/api/highlight/priority/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ browser-compat: api.Highlight.priority
1010

1111
The `priority` property of the {{domxref("Highlight")}} interface is a number used to determine which highlight's styles should be used to resolve style conflicts in overlapping parts. Highlights with a higher `priority` number have preference over those with a lower `priority`.
1212

13-
It is possible to create {{domxref("Range")}} objects that overlap in a document.
13+
It is possible to create {{domxref("AbstractRange")}} objects that overlap in a document.
1414

1515
When overlapping ranges are used by multiple different {{domxref("Highlight")}} objects, and when those highlights are styled using {{cssxref("::highlight")}} pseudo-elements, this may lead to conflicting styles.
1616

0 commit comments

Comments
 (0)