index: Improve HTMLElement duck typing

This patch prevents passing a non-element to `ClassList`.
Merge pull request #22 from component/require-valid-element

index: Improve HTMLElement duck typing