]> source.dussan.org Git - jquery.git/commitdiff
Added a fix for relative // - $("//div",this) (bug #1418)
authorJohn Resig <jeresig@gmail.com>
Wed, 25 Jul 2007 00:39:45 +0000 (00:39 +0000)
committerJohn Resig <jeresig@gmail.com>
Wed, 25 Jul 2007 00:39:45 +0000 (00:39 +0000)
src/selector/selector.js
src/selector/selectorTest.js

index b574fa903e8a7669b5813a6679f4867209bc35e8..2cf0b640417b03fa2cb5535a3a6379afdb589fb9 100644 (file)
@@ -99,7 +99,7 @@ jQuery.extend({
 
                // Handle the common XPath // expression
                if ( !t.indexOf("//") ) {
-                       context = context.documentElement;
+                       //context = context.documentElement;
                        t = t.substr(2,t.length);
 
                // And the / root expression
index c0f0aed9effa2b86027d0705c96f77bcdb06274a..5b77b3b454f80773bd6c2254240e9b030ec0a075 100644 (file)
@@ -183,8 +183,9 @@ test("pseudo (:) selectors", function() {
 });
 
 test("basic xpath", function() {
-       expect(15);
+       expect(16);
        ok( jQuery.find("//*").length >= 30, "All Elements (//*)" );
+       ok( jQuery.find("//div", q("main")[0])[0] = q("foo")[0], "All Relative (#main//div)" );
        t( "All Div Elements", "//div", ["main","foo"] );
        t( "Absolute Path", "/html/body", ["body"] );
        t( "Absolute Path w/ *", "/* /body", ["body"] );