Commit 68b49cf4 authored by John Resig's avatar John Resig

Added some additional checks to make sure that the correct methods are being...

Added some additional checks to make sure that the correct methods are being used in IE on XML documents.
parent 58a17e6e
...@@ -655,15 +655,15 @@ try { ...@@ -655,15 +655,15 @@ try {
// The workaround has to do additional checks after a getElementById // The workaround has to do additional checks after a getElementById
// Which slows things down for other browsers (hence the branching) // Which slows things down for other browsers (hence the branching)
if ( !!document.getElementById( id ) ) { if ( !!document.getElementById( id ) ) {
Expr.find.ID = function(match, context){ Expr.find.ID = function(match, context, isXML){
if ( context.getElementById ) { if ( typeof context.getElementById !== "undefined" && !isXML ) {
var m = context.getElementById(match[1]); var m = context.getElementById(match[1]);
return m ? m.id === match[1] || m.getAttributeNode && m.getAttributeNode("id").nodeValue === match[1] ? [m] : undefined : []; return m ? m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ? [m] : undefined : [];
} }
}; };
Expr.filter.ID = function(elem, match){ Expr.filter.ID = function(elem, match){
var node = elem.getAttributeNode && elem.getAttributeNode("id"); var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
return elem.nodeType === 1 && node && node.nodeValue === match; return elem.nodeType === 1 && node && node.nodeValue === match;
}; };
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment