spamassassin-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Amir Caspi <>
Subject Re: Rules for invisible div and 0pt font?
Date Mon, 17 Jun 2019 20:17:00 GMT
On Jun 17, 2019, at 1:45 PM, @lbutlr <> wrote:
> Would only be active if the width of the window is 900px or less. That can include setting
a display property to hidden or not.

One way of working around that, then, would be to ensure this is only within a div/span tag...

Maybe something like:

rawbody	AC_HIDDEN_ELEMENT	/<(?:div|span|p)\s+[^>]+display\s*:\s*none\s*;/i

One could restrict this further by trying to capture the style= attribute but I don't think
that's necessary.  This formulation should capture a display:none only in an inline style
for div, span, and p elements.

HOWEVER, this formulation also leaves open the very easy workaround of defining a CSS style
for hidden elements (e.g., putting display:none within a CSS class definition) and then setting
the div/span/p element to that class.

So a DIFFERENT workaround would be to ensure that the display:none doesn't occur within a
@media {} block... but because we can't use variable-length lookbehind, the only way I can
think of doing that is to check for @media blocks WITH display:none, and the total number
of display:none, and if the latter is larger, consider the rule to be hit.  I'm not sure how
to compare the number of rule hits in SA... but if we wanted to do that, then:

rawbody	AC_MEDIA_DISPLAYNONE	/@media[^{]*{[^}]*display\s*:\s*none\s*;/i

Then create a meta that hits when AC_HIDDEN_ELEMENT > AC_MEDIA_DISPLAYNONE


--- Amir

View raw message