Tweaked event registration.

- "event" variable was shadowing the identically named method parameter.
- only test for an existing handler for intermediate events.
- cache events depths.
Removed superfluous nil check.
Minor nit.
Use a bare bytes slice instead of a Buffer object for text accumulation.
Extracted AttributeNotFoundError so it can be tested when using Attrs.Get.
Added Attrs.GetString.

Attrs.GetString is a simple wrapper around Attrs.Get that allow to do without non existent attribute checking and to provide a default value in this case.