(shr-descend): Respect display: none.
authorLars Magne Ingebrigtsen <larsi@gnus.org>
Sun, 16 Jun 2013 18:00:17 +0000 (20:00 +0200)
committerLars Magne Ingebrigtsen <larsi@gnus.org>
Sun, 16 Jun 2013 18:00:17 +0000 (20:00 +0200)
lisp/ChangeLog
lisp/shr.el

index e6afdf2..02da057 100644 (file)
@@ -4,6 +4,7 @@
        browsers don't.
        (shr-expand-url): Respect #anchor links.
        (shr-parse-base): Chop off the anchor before using.
+       (shr-descend): Respect display: none.
 
        * eww.el (eww-tag-textarea): Use `text' instead of `editable-field'.
 
index e10bfcd..82c5dd2 100644 (file)
@@ -311,18 +311,21 @@ size, and full-buffer size."
        (shr-stylesheet shr-stylesheet)
        (start (point)))
     (when style
-      (if (string-match "color" style)
+      (if (string-match "color\\|display" 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)))
-    ;; If style is set, then this node has set the color.
-    (when style
-      (shr-colorize-region start (point)
-                          (cdr (assq 'color shr-stylesheet))
-                          (cdr (assq 'background-color shr-stylesheet))))))
+    ;; If we have a display:none, then just ignore this part of the
+    ;; DOM.
+    (unless (equal (cdr (assq 'display shr-stylesheet)) "none")
+      (if (fboundp function)
+         (funcall function (cdr dom))
+       (shr-generic (cdr dom)))
+      ;; If style is set, then this node has set the color.
+      (when style
+       (shr-colorize-region start (point)
+                            (cdr (assq 'color shr-stylesheet))
+                            (cdr (assq 'background-color shr-stylesheet)))))))
 
 (defun shr-generic (cont)
   (dolist (sub cont)