From 64755ed3add17e10a4bd3e4e270cae51cfe1d8c7 Mon Sep 17 00:00:00 2001 From: Lars Magne Ingebrigtsen Date: Thu, 4 Dec 2014 14:42:57 +0100 Subject: [PATCH] * net/shr.el (shr--extract-best-source): Ignore non-text children. --- lisp/ChangeLog | 4 ++++ lisp/net/shr.el | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 157b2b45f98..1f0d7520b60 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2014-12-04 Lars Magne Ingebrigtsen + + * net/shr.el (shr--extract-best-source): Ignore non-text children. + 2014-12-04 Eli Zaretskii Implement copying of a buffer portion while preserving visual order. diff --git a/lisp/net/shr.el b/lisp/net/shr.el index 3ad8bd17777..a2a122cf5d8 100644 --- a/lisp/net/shr.el +++ b/lisp/net/shr.el @@ -1184,7 +1184,7 @@ The preference is a float determined from `shr-prefer-media-type'." "Extract the best `:src' property from blocks in DOM." (setq pref (or pref -1.0)) (let (new-pref) - (dolist (elem (dom-children dom)) + (dolist (elem (dom-non-text-children dom)) (when (and (eq (dom-tag elem) 'source) (< pref (setq new-pref @@ -1193,7 +1193,7 @@ The preference is a float determined from `shr-prefer-media-type'." url (dom-attr elem 'src)) ;; libxml's html parser isn't HTML5 compliant and non terminated ;; source tags might end up as children. So recursion it is... - (dolist (child (dom-children elem)) + (dolist (child (dom-non-text-children elem)) (when (eq (dom-tag child) 'source) (let ((ret (shr--extract-best-source (list child) url pref))) (when (< pref (cdr ret)) -- 2.39.2