// Handle the common XPath // expression
if ( !t.indexOf("//") ) {
- context = context.documentElement;
+ //context = context.documentElement;
t = t.substr(2,t.length);
// And the / root expression
if ( t.indexOf(" ") == 0 ) continue;
foundToken = true;
} else {
- re = /^((\/?\.\.)|([>\/+~]))\s*([a-z]*)/i;
+ re = /^((\/?\.\.)|([>\/+~]))\s*(\w*)/i;
if ( (m = re.exec(t)) != null ) {
r = [];
var elem = ret[ret.length-1];
// Try to do a global search by ID, where we can
- if ( m[1] == "#" && elem && elem.getElementById ) {
+ if ( m[1] == "#" && elem && elem.getElementById && !jQuery.isXMLDoc(elem) ) {
// Optimization for HTML document case
var oid = elem.getElementById(m[2]);