- var s = jQuery.trim(arg), s3 = s.substring(0,3), s6 = s.substring(0,6),
- div = document.createElement("div"), wrap = [0,"",""];
-
- if ( s.substring(0,4) == "<opt" ) // option or optgroup
- wrap = [1, "<select>", "</select>"];
- else if ( s6 == "<thead" || s6 == "<tbody" || s6 == "<tfoot" )
- wrap = [1, "<table>", "</table>"];
- else if ( s3 == "<tr" )
- wrap = [2, "<table><tbody>", "</tbody></table>"];
- else if ( s3 == "<td" || s3 == "<th" ) // <thead> matched above
- wrap = [3, "<table><tbody><tr>", "</tr></tbody></table>"];
+ var s = jQuery.trim(arg), div = document.createElement("div"), tb = [];
+
+ var wrap =
+ // option or optgroup
+ !s.indexOf("<opt") && [1, "<select>", "</select>"] ||
+
+ !s.indexOf("<thead") || !s.indexOf("<tbody") || !s.indexOf("<tfoot") &&
+ [1, "<table>", "</table>"] ||
+
+ !s.indexOf("<tr") &&
+ [2, "<table><tbody>", "</tbody></table>"] ||
+
+ // <thead> matched above
+ !s.indexOf("<td") || !s.indexOf("<th") &&
+ [3, "<table><tbody><tr>", "</tr></tbody></table>"] ||
+
+ [0,"",""];