Incorporate changes made for jquery.highlight-4.js (2nd attempt)

Appears some length checks were added for query selection and pattern.  (This time with the second ternary clause)