Fix items without classes in the tree not being exported.

Classes that have three or fewer items don't get their own directives. However, this would lead to items with those classes being unable to find a directive to put themselves under, and would just be ignored. This has been fixed and now `FindDirectiveForClasses` returns the "best match" (it returns itself if all of its children don't have the class).

I actually am kind of confused why this works, but it does?