diff --git a/qutebrowser/javascript/webelem.js b/qutebrowser/javascript/webelem.js index 206cdf129..749dfcc72 100644 --- a/qutebrowser/javascript/webelem.js +++ b/qutebrowser/javascript/webelem.js @@ -52,12 +52,20 @@ window._qutebrowser.webelem = (function() { "id": id, "text": elem.text, "value": elem.value, - "tag_name": elem.tagName, "outer_xml": elem.outerHTML, "class_name": elem.className, "rects": [], // Gets filled up later }; + // https://github.com/qutebrowser/qutebrowser/issues/2569 + if (typeof elem.tagName === "string") { + out.tag_name = elem.tagName; + } else if (typeof elem.nodeName === "string") { + out.tag_name = elem.nodeName; + } else { + out.tag_name = ""; + } + var attributes = {}; for (var i = 0; i < elem.attributes.length; ++i) { var attr = elem.attributes[i]; diff --git a/tests/end2end/features/misc.feature b/tests/end2end/features/misc.feature index 83de1c822..171fdf476 100644 --- a/tests/end2end/features/misc.feature +++ b/tests/end2end/features/misc.feature @@ -726,3 +726,12 @@ Feature: Various utility commands. Then no crash should happen And the following tabs should be open: - data/numbers/3.txt (active) + + ## Bugs + + # https://github.com/qutebrowser/qutebrowser/issues/2569 + Scenario: Clicking on form element with tagName child + When I open data/issue2569.html + And I run :click-element id theform + And I wait for "Clicked editable element!" in the log + Then no crash should happen