html() performance vs cruft
Hey, we're trying to eke out some more performance from our jquery app, and we noticed that virtually none of our html insertions pass the test to take the innerHTML shortcut and instead are forced to take the .append route which can in some cases double the time of the insertion.
In looking at the test we noticed that .html simply reuses the rnocache regex rather than having it's own specialized "innerHTML vs .append()" regex, and also that the regex takes somewhat of a sledgehammer approach to incoming strings.
In particular, must we use .append for all strings that contain any "<option" ? In the comment in buildFragment() it says that options are excluded because they'll lose their selected state when cloned, which doesn't apply to innerHTML.
However, "<option" can not be innerHTML'ed into a "<select" in IE, so we actually do need some test. I'd recommend that we test the .nodeName of the html injectee to see if it's "SELECT" before we ban "<option" from being inserted. This would also require separating out rnocache for use only for it's named purpose and using an rnoinnerhtml (or somesuch) for the regex regarding whether innerHTML can be employed.
Also, are there actually problems with innerHTMLing <embed and <object ? Googling seems to turn up anecdotal evidence that there's no problem with using innerHTML for these strings.
Finally are there advantages of using .empty().append() instead of innerHTML? The .html() comments imply that innerHTML is preferred, and in my own code innerHTML is better performing, but perhaps I'm missing something?