Only colorise something if we have a node that sets colors.
authorLars Magne Ingebrigtsen <larsi@quimbies.gnus.org>
Mon, 6 Dec 2010 17:03:50 +0000 (18:03 +0100)
committerLars Magne Ingebrigtsen <larsi@quimbies.gnus.org>
Mon, 6 Dec 2010 17:03:50 +0000 (18:03 +0100)
lisp/ChangeLog
lisp/shr.el

index a7bb830..6d3e937 100644 (file)
@@ -1,3 +1,8 @@
+2010-12-06  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+       * shr.el (shr-descend): Only colorise something if we have a node that
+       sets colors.
+
 2010-12-06  Julien Danjou  <julien@danjou.info>
 
        * shr.el (shr-render-td): Render td content with shr-descend, so style
index d30248a..f8aa51e 100644 (file)
@@ -194,17 +194,19 @@ redirects somewhere else."
        (style (cdr (assq :style (cdr dom))))
        (shr-stylesheet shr-stylesheet)
        (start (point)))
-    (when (and style
-              (string-match "color" style))
-      (setq shr-stylesheet (nconc (shr-parse-style style)
-                                 shr-stylesheet)))
+    (when style
+      (if (string-match "color" style)
+         (setq shr-stylesheet (nconc (shr-parse-style style)
+                                     shr-stylesheet))
+       (setq style nil)))
     (if (fboundp function)
        (funcall function (cdr dom))
       (shr-generic (cdr dom)))
     (let ((color (cdr (assq 'color shr-stylesheet)))
          (background (cdr (assq 'background-color
                                 shr-stylesheet))))
-      (when (and shr-stylesheet
+      (when (and style
+                shr-stylesheet
                 (or color background))
        (shr-colorize-region start (point) color background)))))