diff --git a/README.md b/README.md index 7f56cf8..24e1612 100644 --- a/README.md +++ b/README.md @@ -43,8 +43,8 @@ or the [test.html](http://rawgit.com/component/textarea-caret-position/master/te var getCaretCoordinates = require('textarea-caret'); document.querySelector('textarea').addEventListener('input', function () { - var coordinates = getCaretCoordinates(this, this.selectionEnd); - console.log('(top, left, height) = (%s, %s, %s)', coordinates.top, coordinates.left, coordinates.height); + var caret = getCaretCoordinates(this, this.selectionEnd); + console.log('(top, left, height) = (%s, %s, %s)', caret.top, caret.left, caret.height); }) ``` @@ -64,8 +64,11 @@ The function returns a caret coordinates object of the form `{top: , left: , hei ## Known issues +* Edge cases with spaces at the end of lines in ` + +
+

<textarea> manual tests

+
    +
  1. Place the cursor before the "T" in "Then" then press arrow down. Fails in Chrome 58, Firefox 53.
  2. +
  3. Place the cursor before "2." and press left arrow. Fails in Firefox 53, works in Chrome.
  4. +
  5. Place the cursor at the beginning of line "3." then press End. Fails in Chrome 58, Firefox 53.
  6. +
+
+