changedetection.io icon indicating copy to clipboard operation
changedetection.io copied to clipboard

Process subtractive_selectors first

Open emichael opened this issue 3 years ago • 3 comments

Currently, if a filter rule is more selective than the subtractive selector, the subtractive selector will not be executed because the information by which to do the subtraction is already discarded. This fixes that by removing elements first and then applying filter selections.

I haven't tested this PR at all. This changes the behavior of the filtering method (I think to the correct behavior), but it might break automated tests or change the experience for other users.

emichael avatar Sep 27 '22 20:09 emichael

hmmm running tests then we see :)

dgtlmoon avatar Sep 27 '22 20:09 dgtlmoon

@emichael very interesting, can you give me some example html here ?

dgtlmoon avatar Sep 28 '22 09:09 dgtlmoon

Sure.

<html>
<body>
  <div class="foo">
    ABC
  </div>
  <div id="bar">
    <div class="foo">
      DEF
    </div>
  </div>
</body>
</html>

Currently, if you remove div#bar but filter on div.foo, the output is

ABC
DEF

With this change, it would just be

ABC

emichael avatar Sep 28 '22 15:09 emichael