Skip to content

Commit

Permalink
Make the if statements bullets
Browse files Browse the repository at this point in the history
  • Loading branch information
hamishwillee committed Sep 30, 2024
1 parent ae0387f commit 225f590
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions files/en-us/web/api/document/caretpositionfrompoint/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -312,10 +312,9 @@ shadowButton.addEventListener("click", () => {
The method below first checks for `document.caretPositionFromPoint` support and uses it to get the text node and offset at the caret position.
The value of the `useShadows` variable is used to determine whether the shadow root hosted in our text is passed to `caretPositionFromPoint()`.
If the browser doesn't support that method, the code then checks for {{domxref("Document.caretRangeFromPoint", "document.caretRangeFromPoint")}}, and uses that instead.
If the node at the caret position is a text node, the code then splits the node at the selected offset, and inserts a line break between them.
If the node is an element node, then the code inserts a line break element node at the offset.
- If the browser doesn't support that method, the code then checks for {{domxref("Document.caretRangeFromPoint", "document.caretRangeFromPoint")}}, and uses that instead.
- If the node at the caret position is a text node, the code then splits the node at the selected offset, and inserts a line break between them.
- If the node is an element node, then the code inserts a line break element node at the offset.
```js
function insertBreakAtPoint(e) {
Expand Down

0 comments on commit 225f590

Please sign in to comment.