Also try harder to get text content
This commit is contained in:
parent
76ec465f67
commit
421aa0d319
@ -50,7 +50,6 @@ window._qutebrowser.webelem = (function() {
|
|||||||
|
|
||||||
var out = {
|
var out = {
|
||||||
"id": id,
|
"id": id,
|
||||||
"text": elem.text,
|
|
||||||
"value": elem.value,
|
"value": elem.value,
|
||||||
"outer_xml": elem.outerHTML,
|
"outer_xml": elem.outerHTML,
|
||||||
"rects": [], // Gets filled up later
|
"rects": [], // Gets filled up later
|
||||||
@ -72,6 +71,12 @@ window._qutebrowser.webelem = (function() {
|
|||||||
out.class_name = "";
|
out.class_name = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (typeof elem.textContent === "string") {
|
||||||
|
out.text = elem.textContent;
|
||||||
|
} else if (typeof elem.text === "string") {
|
||||||
|
out.text = elem.text;
|
||||||
|
} // else: don't add the text at all
|
||||||
|
|
||||||
var attributes = {};
|
var attributes = {};
|
||||||
for (var i = 0; i < elem.attributes.length; ++i) {
|
for (var i = 0; i < elem.attributes.length; ++i) {
|
||||||
var attr = elem.attributes[i];
|
var attr = elem.attributes[i];
|
||||||
|
@ -1,11 +1,21 @@
|
|||||||
<html>
|
<html>
|
||||||
|
<!-- https://github.com/qutebrowser/qutebrowser/issues/2569 -->
|
||||||
<head>
|
<head>
|
||||||
<title>Form with tagName child</title>
|
<title>Form with tagName child</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<form id="theform">
|
<!--
|
||||||
|
Happens with the tag editor on linux.org.ru
|
||||||
|
https://www.linux.org.ru/user-filter
|
||||||
|
-->
|
||||||
|
<form id="tagnameform">
|
||||||
<input name="tagName" type="text">
|
<input name="tagName" type="text">
|
||||||
</form>
|
</form>
|
||||||
|
<!-- Happens when clicking to the right of a reddit comment form -->
|
||||||
|
<form id="textform">
|
||||||
|
<input name="text" type="text">
|
||||||
|
</form>
|
||||||
|
<!-- Some regressions after we added type checking -->
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="30" height="20" viewBox="0 0 3 2" id="icon">
|
<svg xmlns="http://www.w3.org/2000/svg" width="30" height="20" viewBox="0 0 3 2" id="icon">
|
||||||
<rect width="1" height="2" x="0" fill="#008d46" />
|
<rect width="1" height="2" x="0" fill="#008d46" />
|
||||||
<rect width="1" height="2" x="1" fill="#ffffff" />
|
<rect width="1" height="2" x="1" fill="#ffffff" />
|
||||||
|
@ -79,7 +79,13 @@ Feature: Javascript stuff
|
|||||||
# https://github.com/qutebrowser/qutebrowser/issues/2569
|
# https://github.com/qutebrowser/qutebrowser/issues/2569
|
||||||
Scenario: Clicking on form element with tagName child
|
Scenario: Clicking on form element with tagName child
|
||||||
When I open data/issue2569.html
|
When I open data/issue2569.html
|
||||||
And I run :click-element id theform
|
And I run :click-element id tagnameform
|
||||||
|
And I wait for "Sending fake click to *" in the log
|
||||||
|
Then no crash should happen
|
||||||
|
|
||||||
|
Scenario: Clicking on form element with text child
|
||||||
|
When I open data/issue2569.html
|
||||||
|
And I run :click-element id textform
|
||||||
And I wait for "Sending fake click to *" in the log
|
And I wait for "Sending fake click to *" in the log
|
||||||
Then no crash should happen
|
Then no crash should happen
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user