Dave Methvin schrieb:
>> 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.
>
I don't understand how jQuery.find works nor do I understand what your
modification effects.
As far as I understand it, "p > #myid" should select the element with
the id "myid" only if it is a child of a p element. Does your
modifcation have that effect?
> 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.
>
not('selector,selector') simply isn't currently supported by jQuery,
therefore the failing testcase. I added it as a reminder...
--
Jörn Zaefferer
http://bassistance.de
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/