yui/yui3 — pull request #1006 by sdesai (2013-07-17 22:52:35+00:00)
Title: Fixed NPE on EventTarget.detach('cat | *')

The exception was coming from the private `_getType(type, pre)` method.

We removed the `typeof type === 'string'` check in `getType`, for performance reasons in 3.10.0, since the calling code had it covered already and it sits on many critical paths.

However there's one path, for the 'cat|*' star case, when a default prefix is configured, where a null `type` is passed to `_getType` and it was barfing on the `type.indexOf()` call as a result.

Re-added a simple truthy check (still avoiding the typeof string) before calling indexOf.

Debated (before settling on the above):

1. Leaving `_getType` as is, and just fixing the single place where it's called with null (in the interests of not impacting the other paths, performance wise), but since it's called by getEvent, which is public, leaves it open to more such edge case paths. Figured may as well just take the hit.

2. Re-adding the explicit typeof string check, but felt the above was a decent compromise, without re-introducing the check [ which from the extensive profiling done for 3.10.0, did have an impact ].

*[I've branched off of the v3.11.0 tag on dev-master for this currently, as opposed to dev-master HEAD. We can revisit that if required when we decide on the next release ]*