Skip to content

Commit 8095c0e

Browse files
committed
[css-highlight-api] Use variadic constructor parameter instead of an optional sequence
Closes w3c#4620
1 parent 7301f92 commit 8095c0e

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

css-highlight-api-1/Overview.bs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ Introduction</h2>
100100
r.setStart(document.body, 0);
101101
r.setEnd(document.body, 2);
102102

103-
CSS.highlights.add(new Highlight("example-highlight", [r]));
103+
CSS.highlights.add(new Highlight("example-highlight", r));
104104
</script>
105105
</xmp>
106106

@@ -149,7 +149,7 @@ Creating Custom Highlights</h3>
149149
<dfn interface>Highlight</dfn> objects,
150150
[=setlike=] objects whose [=set entries=] are {{AbstractRange}} objects.
151151
[=Ranges=] can be added to a [=custom highlight=]
152-
either by passing a [=sequence=] of them to its constructor,
152+
either by passing them to its constructor,
153153
or by using the usual API of [=setlike=] objects
154154
to manipulate its [=set entries=].
155155

@@ -164,7 +164,7 @@ Creating Custom Highlights</h3>
164164
<xmp class="idl">
165165
[Exposed=Window]
166166
interface Highlight {
167-
constructor(CSSOMString name, optional sequence<AbstractRange> initialRanges = []);
167+
constructor(CSSOMString name, AbstractRange... initialRanges);
168168
setlike<AbstractRange>;
169169
attribute CSSStyleDeclaration style;
170170
attribute double priority;
@@ -176,7 +176,7 @@ Creating Custom Highlights</h3>
176176
and [[#style-attr]] for more information on the {{Highlight/style}} attribute.
177177

178178
<div algorithm="to create a custom highlight">
179-
When the <dfn for=Highlight constructor>Highlight(CSSOMString name, optional sequence<AbstractRange> initialRanges = [])</dfn> constructor is invoked,
179+
When the <dfn for=Highlight constructor>Highlight(CSSOMString name, AbstractRange... initialRanges)</dfn> constructor is invoked,
180180
run the following steps:
181181

182182
<ol>
@@ -296,7 +296,7 @@ Default Styling of a Custom Highlight</h3>
296296
r.setStart(document.body, 0);
297297
r.setEnd(document.body, 2);
298298

299-
let h = new Highlight("inline-highlight", [r]);
299+
let h = new Highlight("inline-highlight", r);
300300
h.style.backgroundColor = "yellow";
301301
h.style.color = "blue";
302302

@@ -376,7 +376,7 @@ Painting</h4>
376376
r2.setStart(document.body, 3);
377377
r2.setEnd(document.body, 7);
378378

379-
CSS.highlights.add(new Highlight("sample", [r1, r2]));
379+
CSS.highlights.add(new Highlight("sample", r1, r2));
380380
</script>
381381
</xmp>
382382

@@ -457,8 +457,8 @@ Priority of Overlapping Highlights</h4>
457457
r2.setStart(document.body, 3);
458458
r2.setEnd(document.body, 9);
459459

460-
CSS.highlights.add(new Highlight("foo", [r1]));
461-
CSS.highlights.add(new Highlight("bar", [r2]));
460+
CSS.highlights.add(new Highlight("foo", r1));
461+
CSS.highlights.add(new Highlight("bar", r2));
462462
</script>
463463
</xmp>
464464

0 commit comments

Comments
 (0)