Skip to content

Commit 73f06e5

Browse files
committed
[cssom-view] Change defaults for ScrollIntoViewOptions
Fixes #1720.
1 parent 27591aa commit 73f06e5

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

cssom-view/Overview.bs

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1075,14 +1075,14 @@ Note: This {{DOMRect}} object is not <a spec=html>live</a>.
10751075
<pre class=idl>
10761076
enum ScrollLogicalPosition { "start", "center", "end", "nearest" };
10771077
dictionary ScrollIntoViewOptions : ScrollOptions {
1078-
ScrollLogicalPosition block = "center";
1079-
ScrollLogicalPosition inline = "center";
1078+
ScrollLogicalPosition block = "start";
1079+
ScrollLogicalPosition inline = "nearest";
10801080
};
10811081

10821082
partial interface Element {
10831083
DOMRectList getClientRects();
10841084
[NewObject] DOMRect getBoundingClientRect();
1085-
void scrollIntoView(optional (boolean or ScrollIntoViewOptions) arg = true);
1085+
void scrollIntoView(optional (boolean or ScrollIntoViewOptions) arg);
10861086
void scroll(optional ScrollToOptions options);
10871087
void scroll(unrestricted double x, unrestricted double y);
10881088
void scrollTo(optional ScrollToOptions options);
@@ -1140,20 +1140,17 @@ The <dfn method for=Element caniuse=scrollintoview>scrollIntoView(<var>arg</var>
11401140
1. Let <var>options</var> be null.
11411141
1. If <var>arg</var> is a {{ScrollIntoViewOptions}} dictionary, set <var>options</var> to <var>arg</var>. Otherwise:
11421142
1. <a lt="converted to an IDL value">Convert</a> <var>options</var> to a {{ScrollIntoViewOptions}} dictionary. [[!WEBIDL]]
1143-
1. If <var>arg</var> is true, set the {{ScrollIntoViewOptions/block}} dictionary member of <var>options</var> to "<code>start</code>", and set the {{ScrollIntoViewOptions/inline}} dictionary member of <var>options</var> to "<code>nearest</code>".
1144-
1. If <var>arg</var> is false, let the {{ScrollIntoViewOptions/block}} dictionary member of <var>options</var> to "<code>end</code>", and set the {{ScrollIntoViewOptions/inline}} dictionary member of <var>options</var> to "<code>nearest</code>".
1143+
1. If <var>arg</var> is false, let the {{ScrollIntoViewOptions/block}} dictionary member of <var>options</var> to "<code>end</code>".
11451144
1. If the element does not have any associated <a>layout box</a> terminate these steps.
11461145
1. <a lt='scroll an element into view'>Scroll the element into view</a>
11471146
with the options <var>options</var>.
11481147
1. Optionally perform some other action that brings the element to the user's attention.
11491148

1150-
<p class=note highlight=javascript>For historical reasons, passing in <code>true</code> or
1151-
<code>undefined</code> to {{Element/scrollIntoView()}} is equivalent to
1152-
<code>{&nbsp;block:&nbsp;"start",&nbsp;inline:&nbsp;"nearest"&nbsp;}</code>, and passing in
1149+
<p class=note highlight=javascript>Passing in <code>true</code>, <code>undefined</code>, or an empty
1150+
dictionary <code>{}</code> to {{Element/scrollIntoView()}} is equivalent to
1151+
<code>{&nbsp;block:&nbsp;"start",&nbsp;inline:&nbsp;"nearest"&nbsp;}</code>. Passing in
11531152
<code>false</code> is equivalent to
1154-
<code>{&nbsp;block:&nbsp;"end",&nbsp;inline:&nbsp;"nearest"&nbsp;}</code>. Since centering is a
1155-
common case, passing in an empty dictionary <code>{}</code> is equivalent to
1156-
<code>{&nbsp;block:&nbsp;"center",&nbsp;inline:&nbsp;"center"&nbsp;}</code>.
1153+
<code>{&nbsp;block:&nbsp;"end",&nbsp;inline:&nbsp;"nearest"&nbsp;}</code>.
11571154

11581155
The <dfn method for=Element lt="scroll(options)|scroll(x, y)">scroll()</dfn> method must run these steps:
11591156

0 commit comments

Comments
 (0)