diff --git a/qutebrowser/javascript/webelem.js b/qutebrowser/javascript/webelem.js index 72083a121..c4da4031d 100644 --- a/qutebrowser/javascript/webelem.js +++ b/qutebrowser/javascript/webelem.js @@ -285,10 +285,10 @@ window._qutebrowser.webelem = (function() { const frame_elem = call_if_frame(elem, (frame) => serialize_elem(frame.document.activeElement, frame)); - if (frame_elem === null) { - return serialize_elem(elem); + if (frame_elem !== null) { + return frame_elem; } - return frame_elem; + return serialize_elem(elem); }; funcs.find_at_pos = (x, y) => { @@ -306,10 +306,10 @@ window._qutebrowser.webelem = (function() { y - frame_offset_rect.top), frame); }); - if (frame_elem === null) { - return serialize_elem(elem); + if (frame_elem !== null) { + return frame_elem; } - return frame_elem; + return serialize_elem(elem); }; // Function for returning a selection to python (so we can click it) diff --git a/tests/end2end/data/hints/html/wrapped.html b/tests/end2end/data/hints/html/wrapped.html index 2af1a28c1..dcc05c8c7 100644 --- a/tests/end2end/data/hints/html/wrapped.html +++ b/tests/end2end/data/hints/html/wrapped.html @@ -1,8 +1,6 @@ - +
diff --git a/tests/end2end/data/hints/html/wrapped_button.html b/tests/end2end/data/hints/html/wrapped_button.html index dc96bd1d5..4d5fd81bb 100644 --- a/tests/end2end/data/hints/html/wrapped_button.html +++ b/tests/end2end/data/hints/html/wrapped_button.html @@ -1,13 +1,11 @@ - + -