Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added correct explanations to offsets in selection api docs #37630

Merged
merged 2 commits into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion files/en-us/web/api/selection/anchoroffset/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ browser-compat: api.Selection.anchorOffset

The **`Selection.anchorOffset`** read-only property returns the
number of characters that the selection's anchor is offset within the
{{domxref("Selection.anchorNode")}}.
{{domxref("Selection.anchorNode")}} if said node is of type {{domxref("Text")}}, {{domxref("CDATASection")}} or {{domxref("Comment")}}.

In the case of {{domxref("Selection.anchorNode")}} being another type of node, **`Selection.anchorOffset`** returns the number of {{domxref("Node.childNodes")}} the selection's focus is offset within the {{domxref("Selection.anchorNode")}}.

This number is zero-based. If the selection begins with the first character in the
{{domxref("Selection.anchorNode")}}, `0` is returned.
Expand Down
4 changes: 3 additions & 1 deletion files/en-us/web/api/selection/focusoffset/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ browser-compat: api.Selection.focusOffset

The **`Selection.focusOffset`** read-only property returns the
number of characters that the selection's focus is offset within the
{{domxref("Selection.focusNode")}}.
{{domxref("Selection.focusNode")}} if said node is of type {{domxref("Text")}}, {{domxref("CDATASection")}} or {{domxref("Comment")}}.

In the case of {{domxref("Selection.focusNode")}} being another type of node, **`Selection.focusOffset`** returns the number of {{domxref("Node.childNodes")}} the selection's focus is offset within the {{domxref("Selection.focusNode")}}.

This number is zero-based. If the selection ends with the first character in the
{{domxref("Selection.focusNode")}}, `0` is returned.
Expand Down
Loading