Minor refactoring and optimization.

something like `tElement.attr('tabindex', tElement.attr('tabindex') || 0)` would be helpful here to avoid over-writing this attribute if provided.