Fix <optgroup> in selects in eww

* lisp/net/eww.el (eww-tag-select): Use all the options.  This
fixes the problem with <optgroup> elements that wrap them (bug#43217).
This commit is contained in:
Lars Ingebrigtsen 2020-09-05 15:42:26 +02:00
parent 81657507c2
commit b9bdc48b4c

View file

@ -1402,16 +1402,15 @@ See URL `https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Input'.")
(options nil)
(start (point))
(max 0))
(dolist (elem (dom-non-text-children dom))
(when (eq (dom-tag elem) 'option)
(when (dom-attr elem 'selected)
(nconc menu (list :value (dom-attr elem 'value))))
(let ((display (dom-text elem)))
(setq max (max max (length display)))
(push (list 'item
:value (dom-attr elem 'value)
:display display)
options))))
(dolist (elem (dom-by-tag dom 'option))
(when (dom-attr elem 'selected)
(nconc menu (list :value (dom-attr elem 'value))))
(let ((display (dom-text elem)))
(setq max (max max (length display)))
(push (list 'item
:value (dom-attr elem 'value)
:display display)
options)))
(when options
(setq options (nreverse options))
;; If we have no selected values, default to the first value.