Function: eww--html-if-doctype

eww--html-if-doctype is a byte-compiled function defined in eww.el.gz.

Signature

(eww--html-if-doctype HEADERS RESPONSE-BUFFER)

Documentation

Return "text/html" if RESPONSE-BUFFER has an HTML doctype declaration.

HEADERS is unused.

Source Code

;; Defined in /usr/src/emacs/lisp/net/eww.el.gz
(defun eww--html-if-doctype (_headers response-buffer)
  "Return \"text/html\" if RESPONSE-BUFFER has an HTML doctype declaration.
HEADERS is unused."
  ;; https://html.spec.whatwg.org/multipage/syntax.html#the-doctype
  (with-current-buffer response-buffer
    (let ((case-fold-search t))
      (save-excursion
        (goto-char (point-min))
        ;; Match basic "<!doctype html>" and also legacy variants as
        ;; specified in link above -- being purposely lax about it.
        (when (search-forward "<!doctype html" nil t)
          "text/html")))))