Closed Bug 826060 Opened 12 years ago Closed 12 years ago

caretPositionFromPoint returns different offset in textarea as the selection.selectionEnd when clicking on empty area

Categories

(Core :: DOM: Core & HTML, defect)

x86
Windows 7
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 824965

People

(Reporter: martijn.martijn, Unassigned)

References

Details

Testcase is from bug 681387.

The document.caretPositionFromPoint method should return the caret position as to where the caret would be positioned, when you would click/tap on that point in the document.
The resulting offsetNode and offset properties would be equal to the collapsed selection object's focusNode and focusOffset (and in the textfield case, the selectionEnd).

When clicking somewhere in the textarea at the bottom right, I get this as result:
clientX:158 clientY:131
textfield: [object HTMLTextAreaElement] textfield.selectionEnd:3
caretpositionfrompoint.offsetNode:[object HTMLTextAreaElement] caretpositionfrompoint.offset:1

caretpositionfrompoint.offset should return the same as textfield.selectionEnd, which is not the case as you can see.
Summary: caretPositionFromPoint returns different offset in textarea as the selection.focusOffset when clicking on empty areay → caretPositionFromPoint returns different offset in textarea as the selection.selectionEnd when clicking on empty area
Yep, this is (I believe) the same as bug 824965.
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → DUPLICATE
Component: DOM: Other → DOM
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.