In jQuery 1.4 $.contains doesn't return boolean in all browsers - e.g. check the following in IE8 and Firefox:
alert($.contains(document.documentElement, document.body));
I noticed you are using "compareDocumentPosition" in browsers that support it, however, it currently returns 16 or 0 in these browsers instead of the desired true/false. Replacing the following line:
return a.compareDocumentPosition(b) & 16;
with the following:
return !!(a.compareDocumentPosition(b) & 16);
in "sizzle.js" fixes the issue.
PS: Sorry for the unstyled code excerpts but this WYSIWYG editor doesn't seem to work in Opera.. :?