Function: eww-toggle-checkbox
eww-toggle-checkbox is an interactive and byte-compiled function
defined in eww.el.gz.
Signature
(eww-toggle-checkbox)
Documentation
Toggle the value of the checkbox under point.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/net/eww.el.gz
(defun eww-toggle-checkbox ()
"Toggle the value of the checkbox under point."
(interactive nil eww-mode)
(let* ((input (get-text-property (point) 'eww-form))
(type (plist-get input :type)))
(if (equal type "checkbox")
(goto-char
(1+
(if (plist-get input :checked)
(progn
(plist-put input :checked nil)
(eww-update-field eww-form-checkbox-symbol))
(plist-put input :checked t)
(eww-update-field eww-form-checkbox-selected-symbol))))
;; Radio button. Switch all other buttons off.
(let ((name (plist-get input :name)))
(save-excursion
(dolist (elem (eww-inputs (plist-get input :eww-form)))
(when (equal (plist-get (cdr elem) :name) name)
(goto-char (car elem))
(if (not (eq (cdr elem) input))
(progn
(plist-put (cdr elem) :checked nil)
(eww-update-field eww-form-checkbox-symbol))
(plist-put (cdr elem) :checked t)
(eww-update-field eww-form-checkbox-selected-symbol)))))
(forward-char 1)))))