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 @@ - + - Link wrapped across multiple lines + Button link wrapped across multiple lines
diff --git a/tests/end2end/data/hints/iframe_button.html b/tests/end2end/data/hints/iframe_button.html index cd7bf203c..610ed4c88 100644 --- a/tests/end2end/data/hints/iframe_button.html +++ b/tests/end2end/data/hints/iframe_button.html @@ -3,7 +3,7 @@ - Hinting inside an iframe + Hinting a button inside an iframe diff --git a/tests/end2end/data/hints/iframe_input.html b/tests/end2end/data/hints/iframe_input.html index 143577747..903e9a6ee 100644 --- a/tests/end2end/data/hints/iframe_input.html +++ b/tests/end2end/data/hints/iframe_input.html @@ -3,7 +3,7 @@ - Hinting inside an iframe + Hinting an input field inside an iframe diff --git a/tests/end2end/data/iframe_search.html b/tests/end2end/data/iframe_search.html index a06c0ef3e..78f388eeb 100644 --- a/tests/end2end/data/iframe_search.html +++ b/tests/end2end/data/iframe_search.html @@ -3,7 +3,7 @@ - Hinting inside an iframe + Searching inside an iframe