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

ignore configuration filter can be bypassed by links sharing survivors urls #78

Closed
tesnouf-drivy opened this issue Jan 17, 2019 · 2 comments

Comments

@tesnouf-drivy
Copy link

Not sure it is a bug but i found the api to be misleading:

I expect the ignore configuration to filter the links to observe and so to limit to the survivors the "in viewport" mechanism.
It seems to be not exactly the case: any links sharing the same url that a link that was not ignore by the configuration will be observed.

For example, I used the ignore function receiving an element (uri, elem) => {...} to apply prefetching mechanism only on link having a specific attribute.
So it allows me to decide which link should be prefetching by adding a dedicated attribute.

On my page I have 2 links redirecting to the very same url.
The first one is in my header (not visible by default) and the second one is in my footer.
I decided to put my prefetching attribute only on the link in the footer.

But reloading the page, the prefetching is always done even if my footer link is not in the viewport because the link in the header (having not the dedicated attribute and so that should have be ignored) has the same url...

I could force my intended behavior by specifying a region to observe (the footer) but it adds some complexity and code more difficult to maintain.

So I expect a link that doesn't survive the ignore test to not be observed

@lukeed
Copy link
Contributor

lukeed commented Aug 23, 2019

If I understand correctly, I think this is fixed by #120 as the ignore clause (there) will prevent the link from being observed at all.

@demianrenzulli
Copy link
Contributor

In order to ignore a url for any link in the page, you can either:

  • Pass the url directly as an ignore option to quicklink.listen().
  • Identify all the links redirecting to that url in some way: using an attribute, for example, and passing it as ignore option, as explained here.

In this example shared at the beginning of this issue: there were two links redirecting to the same url, but only one of them was marked with the attribute that was passed as an option to ignore. In this case, it would have been preferable to add the attribute to both elements, or pass the url of the link to ignore directly to affect all elements of the page.

Assuming that all links that have redirect to the same url have to be ignored if the developer is actually telling quicklink to explicitly ignore elements with a given attribute, might not be a good way to represent the original intention of the developer in all cases.

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

3 participants