Perfection Kills

by kangax

Exploring Javascript by example

← back 71 words

Event delegation will save the world

If you ever wanted to know how many event handlers your Prototype.js-based application has, but were afraid to count, this tiny bookmarklet will gladly do that for you!

Accidentally, the snippet demonstrates an absolutely wicked use of Prototype’s sacred technique of inject over Hash.

$H(Event.cache).inject(0, function(m, p) {
  m += $H(p.value).values().flatten().size();
  return m;


Did you like this? Donations are welcome

comments powered by Disqus