Open lfre opened 5 years ago
Now it's working
@renosbest _
I'm the maintainer of the Drupal module that integrates quicklink into the CMS. This would really help users of traditional server-rendered CMS' by allowing other components (modules) to tell Quicklink to prefetch their own URLs. So ++
As mentioned before, every intersected link is unobserved to avoid multiple prefetched on it.
@demianrenzulli This is different than #43. The point here is that dynamic elements added to the same container would increase the querySelectorAll
call unnecessarily. This can be avoided by allowing an override of the whole querySelectorAll
call. e.g:
const elements = options.links || (options.el || document).querySelectorAll('a');
Additionally, the current check could be improved by moving the toPrefetch.has
earlier to avoid re-observing here.
Hope that helps to distinguish the 2 issues.
Thanks for confirming this @lfre, and sorry for the confusion!
It seems like it makes sense to keep this open then, so it can be considered as an FR for a future version.
Per the discussion here: https://github.com/GoogleChromeLabs/quicklink/issues/43.
For dynamic content, depending on the page structure the query
options.el.querySelector('a')
, could return links that were already observed/prefetched and now unobserved (thanks to https://github.com/GoogleChromeLabs/quicklink/pull/51).I provided a couple of options here: https://github.com/GoogleChromeLabs/quicklink/issues/43#issuecomment-447595607