mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
range.getBoundingClientRect check for null, fixes #580
This commit is contained in:
@@ -38,18 +38,19 @@
|
||||
range.selectNodeContents(textNode);
|
||||
if(range.getBoundingClientRect) {
|
||||
var rect = range.getBoundingClientRect();
|
||||
if(rect) {
|
||||
var sx = window.scrollX;
|
||||
var sy = window.scrollY;
|
||||
|
||||
var sx = window.scrollX;
|
||||
var sy = window.scrollY;
|
||||
|
||||
return {
|
||||
top: rect.top + sy,
|
||||
left: rect.left + sx,
|
||||
right: rect.left + sx + rect.width,
|
||||
bottom: rect.top + sy + rect.height,
|
||||
width: rect.width,
|
||||
height: rect.height
|
||||
};
|
||||
return {
|
||||
top: rect.top + sy,
|
||||
left: rect.left + sx,
|
||||
right: rect.left + sx + rect.width,
|
||||
bottom: rect.top + sy + rect.height,
|
||||
width: rect.width,
|
||||
height: rect.height
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user