For `nodeName` comparisons we generally use `jQuery.nodeName` method, since it devised specially for this kind of cases. And it should not give big performance overhead.

Also `if` requires <a href="http://contribute.jquery.org/style-guide/js/#good-examples">spaces</a>, same goes for function calls in assertions you added .