Ensure getElementsByClassName exists on element before calling it.  Avoids issues with DocumentFragment.