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

Multistep targeting creates some selector problems #22

Open
rhardih opened this issue Oct 18, 2018 · 2 comments
Open

Multistep targeting creates some selector problems #22

rhardih opened this issue Oct 18, 2018 · 2 comments
Assignees
Labels
bug Something isn't working feature: grudge Issues related to the Grudge feature

Comments

@rhardih
Copy link
Owner

rhardih commented Oct 18, 2018

Disregards the data-tags in the markup below, they're only there to tell tags apart. Consider the following:

<div>
  <div></div>
  <p data-first></p>
  <p data-second></p>
</div>

Killing the first p element here would result in a stored selector of div > p:nth-of-type(1), which is correct in that it uniquely targets that element.

Reloading the page will let ekill remove that p element so the markup now looks like this:

<div>
  <div></div>
  <p data-second></p>
</div>

What happens when the second p element is now killed?

Two things go wrong here. Firstly the generated DOMString will be just be div > p, since that is correct for this new markup, and secondly it will remove the previously stored div > p:nth-of-type(1), because the substring match will consider div > p to signify a parent of div > p:nth-of-type(1).

In the end, what is left in the Hit List is just div > p, which is obviously wrong with regards to what the user intended, which was to have both elements killed off.

@rhardih rhardih added bug Something isn't working feature: grudge Issues related to the Grudge feature labels Oct 18, 2018
@rhardih rhardih self-assigned this Oct 18, 2018
@rhardih
Copy link
Owner Author

rhardih commented Oct 29, 2018

Second issue here is fixed by 8654d22.

@rhardih
Copy link
Owner Author

rhardih commented Oct 29, 2018

One possible solution would be to just inject style.display = 'none', instead of actually removing the element from the dom.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working feature: grudge Issues related to the Grudge feature
Projects
None yet
Development

No branches or pull requests

1 participant