fixed events.js to support the new traversal API