Fix <button>...</button> submit button rendering in eww

* lisp/net/eww.el (eww-form-submit): Use the contents of the
<button>...</button> for the string if there is no value
(bug#39326).
This commit is contained in:
Lars Ingebrigtsen 2020-02-20 14:44:16 +01:00
parent b7d5a64f40
commit 55ad194922

View file

@ -1107,11 +1107,13 @@ just re-display the HTML already fetched."
(defun eww-form-submit (dom)
(let ((start (point))
(value (dom-attr dom 'value)))
(setq value
(if (zerop (length value))
"Submit"
value))
(insert value)
(if (null value)
(shr-generic dom)
(insert value))
;; If the contents of the <button>...</button> turns out to be
;; empty, or the value was blank, default to this:
(when (= (point) start)
(insert "Submit"))
(add-face-text-property start (point) 'eww-form-submit)
(put-text-property start (point) 'eww-form
(list :eww-form eww-form