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 elements? #38

Closed
aolko opened this issue Dec 14, 2018 · 4 comments
Closed

Ignore elements? #38

aolko opened this issue Dec 14, 2018 · 4 comments

Comments

@aolko
Copy link

aolko commented Dec 14, 2018

Can you ignore specific elements? "Quicklink everything but [...]" case

@lukeed
Copy link
Contributor

lukeed commented Dec 14, 2018

We will be adding a filter option that will assert against the URL(s) in question. Although it's not exactly the same you're requesting, I think that should work for you, right?

If you needed to rely on the DOM (aka, can't know the ignore patterns ahead of time), this would be possible:

// assumes your links are <a href="..." noprefetch /> to avoid
const toIgnore = Array.from(document.querySelectorAll('a[noprefetch]'), x => x.href);

// run (future) quicklink
quicklink({
  filter: url => !toIgnore.includes(url)
})

@aolko
Copy link
Author

aolko commented Dec 14, 2018

alright, ETA for filter?

@schollz
Copy link

schollz commented Dec 14, 2018

This is really useful if one of the links is "/logout" which may cause deletion of the cookies, etc.

Looking forward to it!

addyosmani added a commit that referenced this issue Dec 14, 2018
feat(restrict to same origins, add ignores)
@addyosmani
Copy link
Collaborator

Fixed by 1ff3554. origins and ignores will be in the next release so filtering will be available shortly.

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

Successfully merging a pull request may close this issue.

5 participants
@addyosmani @aolko @lukeed @schollz and others