code: http://jsfiddle.net/4hV6c/4/
just make any selection, and you’ll get a script error in ie8
I’m trying to do this:
$(end_node.parentNode).has(start_node)
which in modern browsers (chrome, ff, opera, etc) returns [] if start_node is not in end_node.parentNode, and returns the element (I forget which) if it is found.
now, end_node is a text element, and the parentNode is an actual DOM entity. IE will perform .has on just $(end_node).has(start_node) but that is obviously different behavior.
Is there a work around to get this to work?
- in IE the fiddle will error, other browsers will alert you with a boolean value.
UPDATE: here is a word around that overrides .has() for my specific scenario.. not sure if it works for all the cases of .has, as I don’t know them all.
http://jsfiddle.net/8F57r/13/
The problem is
notjQueryRunning
However, the following throws an exception http://jsfiddle.net/mendesjuan/4hV6c/8/
What that means is that you can’t pass a text node into
$.has. You should file a bug with jQueryThe line that is erroring out is giving the following message
No such interface supported jquery-1.7.1.js, line 5244 character 3That is trying to call the
containsmethod on a node. What that means is that this really is an IE bug that jQuery hasn’t worked around. I’ve reproduced the problem without needing to call$.hashttp://jsfiddle.net/4hV6c/10/Workaround http://jsfiddle.net/4hV6c/12/