Function: eww-handle-link

eww-handle-link is a byte-compiled function defined in eww.el.gz.

Signature

(eww-handle-link DOM)

Source Code

;; Defined in /usr/src/emacs/lisp/net/eww.el.gz
(defun eww-handle-link (dom)
  (let* ((rel (dom-attr dom 'rel))
         (href (dom-attr dom 'href)))
    (when (and href rel)
      ;; `rel' is a case-insensitive whitespace-separated set, but
      ;; without considering vertical tab "\v" whitespace (as defined at
      ;; https://infra.spec.whatwg.org/#ascii-whitespace).
      (dolist (relation (split-string (downcase rel) "[\t\n\f\r ]+"))
        (when-let*
            ((where (assoc
                     relation
                     '(("next" . :next)
                       ;; Texinfo uses "previous", but HTML specifies
                       ;; "prev", so recognize both.
                       ("previous" . :previous)
                       ("prev" . :previous)
                       ;; HTML specifies "start" but also "contents",
                       ;; and Gtk seems to use "home".  Recognize
                       ;; them all; but store them in different
                       ;; variables so that we can readily choose the
                       ;; "best" one.
                       ("start" . :start)
                       ("home" . :home)
                       ("contents" . :contents)
                       ("up" . :up)))))
          (when (memq (cdr where) '(:next :previous))
            ;; Multi-page isearch support.
            (setq-local multi-isearch-next-buffer-function
                        #'eww-isearch-next-buffer))
          (plist-put eww-data (cdr where) href))))))