You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by qu...@apache.org on 2005/05/02 09:41:23 UTC

svn commit: r165601 - in /spamassassin/trunk: lib/Mail/SpamAssassin/HTML.pm rules/70_testing.cf

Author: quinlan
Date: Mon May  2 00:41:21 2005
New Revision: 165601

URL: http://svn.apache.org/viewcvs?rev=165601&view=rev
Log:
more display:none tests

Modified:
    spamassassin/trunk/lib/Mail/SpamAssassin/HTML.pm
    spamassassin/trunk/rules/70_testing.cf

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/HTML.pm
URL: http://svn.apache.org/viewcvs/spamassassin/trunk/lib/Mail/SpamAssassin/HTML.pm?rev=165601&r1=165600&r2=165601&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/HTML.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/HTML.pm Mon May  2 00:41:21 2005
@@ -62,7 +62,7 @@
 
 # elements that change text style
 my %elements_text_style = map {; $_ => 1 }
-  qw( body font table tr th td big small basefont marquee span ),
+  qw( body font table tr th td big small basefont marquee span img ),
 ;
 
 # elements that insert whitespace
@@ -91,6 +91,7 @@
 $ok_attributes{th}{$_} = 1 for qw( bgcolor );
 $ok_attributes{tr}{$_} = 1 for qw( bgcolor );
 $ok_attributes{span}{$_} = 1 for qw( style );
+$ok_attributes{img}{$_} = 1 for qw( style );
 
 sub new {
   my ($class) = @_;
@@ -552,6 +553,21 @@
 	  $new{$name} = $attr->{$name};
 	}
       }
+      # all styles, not part of the if/elsif series
+      # START test code
+      if ($name eq "style") {
+	my $style = $new{style} = $attr->{style};
+	my @parts = split(/;/, $style);
+	foreach (@parts) {
+	  if (/\s*display:\s*none\b/i) {
+	    $self->put_results(display_none => 1);
+	    if ($tag eq "img") {
+	      $self->put_results(img_display_none => 1);
+	    }
+	  }
+	}
+      }
+      # END test code
       if ($new{size} > $self->{max_size}) {
 	$self->{max_size} = $new{size};
       }

Modified: spamassassin/trunk/rules/70_testing.cf
URL: http://svn.apache.org/viewcvs/spamassassin/trunk/rules/70_testing.cf?rev=165601&r1=165600&r2=165601&view=diff
==============================================================================
--- spamassassin/trunk/rules/70_testing.cf (original)
+++ spamassassin/trunk/rules/70_testing.cf Mon May  2 00:41:21 2005
@@ -792,6 +792,13 @@
 body T_HTML_INVIS_SPAN	eval:html_test('span_invisible')
 body T_HTML_INVIS_TEXT	eval:html_test('invisible_text')
 
+# another
+body T_HTML_DISPLAY_NONE	eval:html_test('display_none')
+describe T_HTML_DISPLAY_NONE	CSS style contains "display:none"
+
+body T_HTML_IMG_DISPLAY_NONE	eval:html_test('img_display_none')
+describe T_HTML_IMG_DISPLAY_NONE	image CSS style contains "display:none"
+
 # bug 3070
 # this might have high overlap with other rules, double-check
 # before promoting