> I'm just wondering if we could implement an at least
> not-that-slow-if-used-often approach to simulate
> getElementById eg. on XML docs.
I think you could just change this:
if ( m[1] == "#" ) {
// Ummm, should make this
work in all XML docs
var oid =
document.getElementById(m[2]);
r = ret = oid ? [oid] : [];
t = t.replace( re2, "" );
} else {
if ( !m[2] || m[1] == "." )
m[2] = "*";
to this:
if ( m[1] == "#" &&
ret[0].getElementById ) {
var oid =
ret[0].getElementById(m[2]);
r = ret = oid ? [oid] : [];
t = t.replace( re2, "" );
} else {
if ( !m[2] || m[1] == "." ||
m[1] == '#' ) m[2] = "*";
That would also skip getElementById for cases like "p > #myid" which I think
is the correct behavior; I think there is a bug filed against this already.
For some reason the second "not('selector,selector')" case in my local copy
of the test suite is failing--even with the old code--but I can't tell why.
Maybe it's some other change I have in my local copy.
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/