Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xpath comparing positions with count and preceding-sibling doesn't work #146

Open
slavaleleka opened this issue Jul 4, 2022 · 0 comments
Assignees

Comments

@slavaleleka
Copy link
Contributor

@DetachHead commented on Sun Jul 03 2022

given the following html:

<html>
<head></head>
<body>
<div class="header">header</div>
<div>post content</div>
<div>post content</div>
<div class="separator"></div>
<div class="header"><span>sponsored</span></div>
<div>post content</div> <!-- hide -->
<div>post content</div> <!-- hide -->
<div>post content</div> <!-- hide -->
<div class="separator"></div>
<div class="header">header</div>
<div>post content</div>
<div>post content</div>
<div>post content</div>
<div>post content</div>
<div>post content</div>
<div class="separator"></div>
<div class="header"><span>sponsored</span></div>
<div>post content</div> <!-- hide -->
<div>post content</div> <!-- hide -->
<div class="separator"></div>
<div class="header">header</div>
<div>post content</div>
<div>post content</div>
<div>post content</div>
<div>post content</div>
</body>
</html>

i created the following xpath to compare the positions of the previous "sponsored" span and the previous "separator" div in order to determine which "post content" divs to block:

//div[count(./preceding-sibling::div[@class='header' and .//span[.='sponsored']][1]/preceding-sibling::*) > count(./preceding-sibling::div[@class='separator'][1]/preceding-sibling::*)]

this works in ublock origin, but not in adguard

Issue Details

  • AdGuard version: 4.0.181
  • Browser and version: chrome 103.0.5060.66 and safari (ios 15.1.1)
  • Operating system and version: windows 10 and ios 15.1.1
  • Filters you use in AdGuard: *##:xpath(//div[count(./preceding-sibling::div[@class='header' and .//span[.='sponsored']][1]/preceding-sibling::*) > count(./preceding-sibling::div[@class='separator'][1]/preceding-sibling::*)])
  • Stealth Mode settings: n/a
  • Other browser extensions: ublock origin (to compare the behavior, disabled while testing adguard)

Expected Behavior

elements blocked in both ublock and adguard

Actual Behavior

elements only blocked in ublock

Screenshots

ublock origin

image

adguard

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants