Fix various js problems with frame support
This commit is contained in:
parent
d4001a4a98
commit
c737d7ab22
@ -55,7 +55,9 @@ window._qutebrowser.webelem = (function() {
|
|||||||
try {
|
try {
|
||||||
caret_position = elem.selectionStart;
|
caret_position = elem.selectionStart;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (err.constructor.name === "DOMException" &&
|
if ((err instanceof DOMException ||
|
||||||
|
(frame !== null &&
|
||||||
|
err instanceof frame.DOMException)) &&
|
||||||
err.name === "InvalidStateError") {
|
err.name === "InvalidStateError") {
|
||||||
// nothing to do, caret_position is already null
|
// nothing to do, caret_position is already null
|
||||||
} else {
|
} else {
|
||||||
@ -107,9 +109,17 @@ window._qutebrowser.webelem = (function() {
|
|||||||
// TODO How to generate a 0 object without this
|
// TODO How to generate a 0 object without this
|
||||||
let frame_offset_rect = null;
|
let frame_offset_rect = null;
|
||||||
if (frame === null) {
|
if (frame === null) {
|
||||||
frame_offset_rect = document.head.getBoundingClientRect();
|
// Dummy object with zero offset
|
||||||
|
frame_offset_rect = {
|
||||||
|
"top": 0,
|
||||||
|
"right": 0,
|
||||||
|
"bottom": 0,
|
||||||
|
"left": 0,
|
||||||
|
"height": 0,
|
||||||
|
"width": 0,
|
||||||
|
};
|
||||||
} else {
|
} else {
|
||||||
frame_offset_rect = frame.getBoundingClientRect();
|
frame_offset_rect = frame.frameElement.getBoundingClientRect();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let k = 0; k < client_rects.length; ++k) {
|
for (let k = 0; k < client_rects.length; ++k) {
|
||||||
@ -193,7 +203,7 @@ window._qutebrowser.webelem = (function() {
|
|||||||
|
|
||||||
const subelems = subelem_frames[i].document.
|
const subelems = subelem_frames[i].document.
|
||||||
querySelectorAll(selector);
|
querySelectorAll(selector);
|
||||||
const frame = subelem_frames[i].frameElement;
|
const frame = subelem_frames[i];
|
||||||
for (let elem_num = 0; elem_num < subelems.length; ++elem_num) {
|
for (let elem_num = 0; elem_num < subelems.length; ++elem_num) {
|
||||||
if (!only_visible || is_visible(subelems[elem_num])) {
|
if (!only_visible || is_visible(subelems[elem_num])) {
|
||||||
out.push(serialize_elem(subelems[elem_num], frame));
|
out.push(serialize_elem(subelems[elem_num], frame));
|
||||||
|
Loading…
Reference in New Issue
Block a user