aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Resig <jeresig@gmail.com>2007-07-25 00:39:45 +0000
committerJohn Resig <jeresig@gmail.com>2007-07-25 00:39:45 +0000
commitbdf05d890fe3a8cc085b2b4f13881ca043943e44 (patch)
treed25baf2abd374e6260c0e6abcc76f700fc0abdc2
parenta65a811ce03b2f7900ae0daa18d4d9fc213acbfd (diff)
downloadjquery-bdf05d890fe3a8cc085b2b4f13881ca043943e44.tar.gz
jquery-bdf05d890fe3a8cc085b2b4f13881ca043943e44.zip
Added a fix for relative // - $("//div",this) (bug #1418)
-rw-r--r--src/selector/selector.js2
-rw-r--r--src/selector/selectorTest.js3
2 files changed, 3 insertions, 2 deletions
diff --git a/src/selector/selector.js b/src/selector/selector.js
index b574fa903..2cf0b6404 100644
--- a/src/selector/selector.js
+++ b/src/selector/selector.js
@@ -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
diff --git a/src/selector/selectorTest.js b/src/selector/selectorTest.js
index c0f0aed9e..5b77b3b45 100644
--- a/src/selector/selectorTest.js
+++ b/src/selector/selectorTest.js
@@ -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"] );