Support <optgroup> tags in <select> forms.

* net/eww.el (eww-tag-select): Support <optgroup> tags in <select>
forms.

Test case:

<html>
<head><title>SELECT TEST</title></head>
<body>

<form method="POST" action="./dummy.php">
<input type="text" name="text1">
<input type="submit" name="btn1" value="val1">

<select>
<optgroup label="group 1">
<option value="a">Value A</option>
<option value="b">Value B</option>
</optgroup>
<optgroup label="group 2">
<option value="c">Value C</option>
<option value="d">Value D</option>
</optgroup>
</select>

</form>
</body>
</html>

Fixes: debbugs:15860
This commit is contained in:
Kenjiro NAKAYAMA 2013-12-01 14:21:53 +01:00 committed by Lars Magne Ingebrigtsen
parent ab6dea82bf
commit 9dd99753de
2 changed files with 13 additions and 2 deletions

View file

@ -1,3 +1,8 @@
2013-12-01 Kenjiro NAKAYAMA <nakayamakenjiro@gmail.com>
* net/eww.el (eww-tag-select): Support <optgroup> tags in <select>
forms.
2013-12-01 Lars Magne Ingebrigtsen <larsi@gnus.org>
* net/eww.el (eww-restore-history): Update the window title after

View file

@ -737,8 +737,14 @@ appears in a <link> or <a> tag."
:eww-form eww-form))
(options nil)
(start (point))
(max 0))
(dolist (elem cont)
(max 0)
opelem)
(if (eq (car (car cont)) 'optgroup)
(dolist (groupelem cont)
(unless (cdr (assq :disabled (cdr groupelem)))
(setq opelem (append opelem (cdr (cdr groupelem))))))
(setq opelem cont))
(dolist (elem opelem)
(when (eq (car elem) 'option)
(when (cdr (assq :selected (cdr elem)))
(nconc menu (list :value