Update spanDir.js

workaround for [Cannot call method "sort" of null]