The problem is not jQuery
Launch
console.log( $("div:has(span)").html() );
console.log( $("div").has($("span")[0]).html() );
However, the following excludes http://jsfiddle.net/mendesjuan/4hV6c/8/
var textNode = $("span")[0].childNodes[0];
$("div").has(textNode);
This means that you cannot pass node text to $.has. You must specify an error using jQuery
The line that produces the error contains the following message
No such interface supported jquery-1.7.1.js, line 5244 character 3
contains node. , IE, jQuery . , $.has http://jsfiddle.net/4hV6c/10/
var textNode = $("span")[0].childNodes[0];
var divNode = $("div")[0];
divNode.contains(textNode);
http://jsfiddle.net/4hV6c/12/
function contains(outer, inner) {
var current = inner;
do {
if (current == outer) {
return true;
}
} while((current = current.parentNode) != document.body);
return false;
}
rangy.init();
$(document).bind("mouseup", function() {
var a = rangy.getSelection();
start_node = a.anchorNode;
end_node = a.focusNode;
var b = a.getRangeAt(0);
var c = b.commonAncestorContainer;
b.selectNodeContents(c);
a.setSingleRange(b);
alert( contains( end_node.parentNode, start_node) );
});