Range getClientRects() not working

30 views
Skip to first unread message

@Krishh

unread,
May 28, 2014, 1:43:55 AM5/28/14
to chromiu...@chromium.org
The Chrome version I've is 35.0.1916.114 m. Prior to this version I was able to get Range's client Rect and its top/left/bottom/right values. But in this version, the getClientRects() method returns a list of size zero. Please help with changes to get the client rects in this version of Chrome.

The sample code is :

        var sel = window.getSelection();
if (sel.rangeCount) {
range = sel.getRangeAt(0).cloneRange();
if (range.getClientRects) {
range.collapse(true);
var rect = range.getClientRects()[0];
leftPos = rect.left;
topPos = rect.top;
}
}
getClientRect_Issue.png
Reply all
Reply to author
Forward
0 new messages