6 ms·
It also ignores the cursor position in the entered text (i.e., it will always look at the last character). That's because the code creates a fake input element
by tralarpa 4y ago
It also ignores the cursor position in the entered text (i.e., it will always look at the last character). That's because the code creates a fake input element with the same font and input as the visible element and uses its size to determine the position to look at. Strange that it doesn't work for input with leading spaces, though.
- samwillis 4y agoIt's probably either trimming the string, or the dom is collapsing the spaces to a single space (as is standard). It's possible to fetch the cursor position in the input.