Skip to content

Instantly share code, notes, and snippets.

@davidbgk
Created May 31, 2013 12:52
Show Gist options
  • Save davidbgk/5684767 to your computer and use it in GitHub Desktop.
Save davidbgk/5684767 to your computer and use it in GitHub Desktop.
Formation CasperJS avec @n1k0 chez SFEIR le 31 mai 2013 pour scopyleft.
@piouPiouM
Copy link

C'est du détail, mais la fonction getEmptyLinks peut être simplifiée pour éviter d'itérer sur tous les liens :

function getEmptyLinks(selector) {
  var links = document.querySelectorAll(selector + ' a[href="#"],' + selector + ' a[href=""]');
  return Array.prototype.map.call(links, function(e) {
    return e.textContent.trim();
  });
}

edit : merci pour le partage :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment