Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
J
jquery
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
夏彬
jquery
Commits
5200194f
Commit
5200194f
authored
Oct 12, 2010
by
John Resig
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make sure that .find() with multiple direct child selectors is handled correctly. Fixes #7144.
parent
ff6ceadb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
3 deletions
+4
-3
traversing.js
src/traversing.js
+2
-2
traversing.js
test/unit/traversing.js
+2
-1
No files found.
src/traversing.js
View file @
5200194f
...
@@ -4,7 +4,7 @@ var runtil = /Until$/,
...
@@ -4,7 +4,7 @@ var runtil = /Until$/,
rparentsprev
=
/^
(?:
parents|prevUntil|prevAll
)
/
,
rparentsprev
=
/^
(?:
parents|prevUntil|prevAll
)
/
,
// Note: This RegExp should be improved, or likely pulled from Sizzle
// Note: This RegExp should be improved, or likely pulled from Sizzle
rmultiselector
=
/,/
,
rmultiselector
=
/,/
,
rchild
=
/
^
\s
*>/
,
rchild
=
/
(
^|,
)\s
*>/g
,
isSimple
=
/^.
[^
:#
\[\.
,
]
*$/
,
isSimple
=
/^.
[^
:#
\[\.
,
]
*$/
,
slice
=
Array
.
prototype
.
slice
,
slice
=
Array
.
prototype
.
slice
,
POS
=
jQuery
.
expr
.
match
.
POS
;
POS
=
jQuery
.
expr
.
match
.
POS
;
...
@@ -13,7 +13,7 @@ jQuery.fn.extend({
...
@@ -13,7 +13,7 @@ jQuery.fn.extend({
find
:
function
(
selector
)
{
find
:
function
(
selector
)
{
// Handle "> div" child selectors and pass them to .children()
// Handle "> div" child selectors and pass them to .children()
if
(
typeof
selector
===
"string"
&&
rchild
.
test
(
selector
)
)
{
if
(
typeof
selector
===
"string"
&&
rchild
.
test
(
selector
)
)
{
return
this
.
children
(
selector
.
replace
(
rchild
,
""
)
);
return
this
.
children
(
selector
.
replace
(
rchild
,
"
$1
"
)
);
}
}
var
ret
=
this
.
pushStack
(
""
,
"find"
,
selector
),
length
=
0
;
var
ret
=
this
.
pushStack
(
""
,
"find"
,
selector
),
length
=
0
;
...
...
test/unit/traversing.js
View file @
5200194f
module
(
"traversing"
);
module
(
"traversing"
);
test
(
"find(String)"
,
function
()
{
test
(
"find(String)"
,
function
()
{
expect
(
3
);
expect
(
4
);
equals
(
'Yahoo'
,
jQuery
(
'#foo'
).
find
(
'.blogTest'
).
text
(),
'Check for find'
);
equals
(
'Yahoo'
,
jQuery
(
'#foo'
).
find
(
'.blogTest'
).
text
(),
'Check for find'
);
// using contents will get comments regular, text, and comment nodes
// using contents will get comments regular, text, and comment nodes
...
@@ -9,6 +9,7 @@ test("find(String)", function() {
...
@@ -9,6 +9,7 @@ test("find(String)", function() {
equals
(
j
.
find
(
"div"
).
length
,
0
,
"Check node,textnode,comment to find zero divs"
);
equals
(
j
.
find
(
"div"
).
length
,
0
,
"Check node,textnode,comment to find zero divs"
);
same
(
jQuery
(
"#main"
).
find
(
"> div"
).
get
(),
q
(
"foo"
,
"moretests"
,
"tabindex-tests"
,
"liveHandlerOrder"
,
"siblingTest"
),
"find child elements"
);
same
(
jQuery
(
"#main"
).
find
(
"> div"
).
get
(),
q
(
"foo"
,
"moretests"
,
"tabindex-tests"
,
"liveHandlerOrder"
,
"siblingTest"
),
"find child elements"
);
same
(
jQuery
(
"#main"
).
find
(
"> #foo, > #moretests"
).
get
(),
q
(
"foo"
,
"moretests"
),
"find child elements"
);
});
});
test
(
"is(String)"
,
function
()
{
test
(
"is(String)"
,
function
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment