aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJohn Resig <jeresig@gmail.com>2007-08-27 04:58:02 +0000
committerJohn Resig <jeresig@gmail.com>2007-08-27 04:58:02 +0000
commit127c0b8a5d9ab35f9f0b91688a8ff7df45244977 (patch)
treed7f4c0c84c47abdc2fe3282b5b75d4b76b77da9c /src
parent3ae74b523ec379a1753d116bb7f1aec8db2c52d4 (diff)
downloadjquery-127c0b8a5d9ab35f9f0b91688a8ff7df45244977.tar.gz
jquery-127c0b8a5d9ab35f9f0b91688a8ff7df45244977.zip
Fixed the issue where $("body").find("div#foo") would ignore the specified tag name. (Bug #1543)
Diffstat (limited to 'src')
-rw-r--r--src/selector/selector.js2
-rw-r--r--src/selector/selectorTest.js4
2 files changed, 4 insertions, 2 deletions
diff --git a/src/selector/selector.js b/src/selector/selector.js
index b15ee7cde..5fc3e0ed9 100644
--- a/src/selector/selector.js
+++ b/src/selector/selector.js
@@ -247,7 +247,7 @@ jQuery.extend({
// We need to find all descendant elements
for ( var i = 0; ret[i]; i++ ) {
// Grab the tag name being searched for
- var tag = m[1] != "" || m[0] == "" ? "*" : m[2];
+ var tag = m[1] == "#" && m[3] ? m[3] : m[1] != "" || m[0] == "" ? "*" : m[2];
// Handle IE7 being really dumb about <object>s
if ( tag == "*" && ret[i].nodeName.toLowerCase() == "object" )
diff --git a/src/selector/selectorTest.js b/src/selector/selectorTest.js
index 7a4789a80..458804bbf 100644
--- a/src/selector/selectorTest.js
+++ b/src/selector/selectorTest.js
@@ -41,7 +41,7 @@ test("broken", function() {
});
test("id", function() {
- expect(24);
+ expect(25);
t( "ID Selector", "#body", ["body"] );
t( "ID Selector w/ Element", "body#body", ["body"] );
t( "ID Selector w/ Element", "ul#first", [] );
@@ -72,6 +72,8 @@ test("id", function() {
t( "ID Selector on Form with an input that has a name of 'id'", "#lengthtest", ["lengthtest"] );
t( "ID selector with non-existant ancestor", "#asdfasdf #foobar", [] ); // bug #986
+
+ isSet( $("body").find("div#form"), [], "ID selector within the context of another element" );
});
test("class", function() {