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
f1f6bc3e
Commit
f1f6bc3e
authored
Sep 28, 2010
by
John Resig
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle child selectors in particular - away from the selector engine. Fixes #7029.
parent
873c2842
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
1 deletion
+9
-1
traversing.js
src/traversing.js
+6
-0
traversing.js
test/unit/traversing.js
+3
-1
No files found.
src/traversing.js
View file @
f1f6bc3e
...
@@ -4,11 +4,17 @@ var runtil = /Until$/,
...
@@ -4,11 +4,17 @@ 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
*>/
,
isSimple
=
/^.
[^
:#
\[\.
,
]
*$/
,
isSimple
=
/^.
[^
:#
\[\.
,
]
*$/
,
slice
=
Array
.
prototype
.
slice
;
slice
=
Array
.
prototype
.
slice
;
jQuery
.
fn
.
extend
({
jQuery
.
fn
.
extend
({
find
:
function
(
selector
)
{
find
:
function
(
selector
)
{
// Handle "> div" child selectors and pass them to .children()
if
(
typeof
selector
===
"string"
&&
rchild
.
test
(
selector
)
)
{
return
this
.
children
(
selector
.
replace
(
rchild
,
""
)
);
}
var
ret
=
this
.
pushStack
(
""
,
"find"
,
selector
),
length
=
0
;
var
ret
=
this
.
pushStack
(
""
,
"find"
,
selector
),
length
=
0
;
for
(
var
i
=
0
,
l
=
this
.
length
;
i
<
l
;
i
++
)
{
for
(
var
i
=
0
,
l
=
this
.
length
;
i
<
l
;
i
++
)
{
...
...
test/unit/traversing.js
View file @
f1f6bc3e
module
(
"traversing"
);
module
(
"traversing"
);
test
(
"find(String)"
,
function
()
{
test
(
"find(String)"
,
function
()
{
expect
(
2
);
expect
(
3
);
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
var
j
=
jQuery
(
"#nonnodes"
).
contents
();
var
j
=
jQuery
(
"#nonnodes"
).
contents
();
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"
);
});
});
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