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
11c9de47
Commit
11c9de47
authored
Sep 20, 2011
by
timmywil
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added filtering tests and updating sizzle to fix filtering with positional selectors. Fixes #10315.
parent
9b3768b9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
1 deletion
+44
-1
sizzle
src/sizzle
+1
-1
traversing.js
test/unit/traversing.js
+43
-0
No files found.
sizzle
@
0afda8fc
Subproject commit
5003e31312b9309f88cc1019b0a8702daac20b16
Subproject commit
0afda8fcb59cfb16fa75e25b9eea25ee32841bb3
test/unit/traversing.js
View file @
11c9de47
...
@@ -101,6 +101,49 @@ test("is(jQuery)", function() {
...
@@ -101,6 +101,49 @@ test("is(jQuery)", function() {
ok
(
!
jQuery
(
"#simon"
).
is
(
jQuery
(
".blogTest"
)[
0
]
),
"Check for multiple classes: Expected classes 'blog' and 'link', but not 'blogTest'"
);
ok
(
!
jQuery
(
"#simon"
).
is
(
jQuery
(
".blogTest"
)[
0
]
),
"Check for multiple classes: Expected classes 'blog' and 'link', but not 'blogTest'"
);
});
});
test
(
"filter() with positional selectors"
,
function
()
{
expect
(
19
);
var
html
=
jQuery
(
''
+
'<p id="posp">'
+
'<a class="firsta" href="#">'
+
'<em>first</em>'
+
'</a>'
+
'<a class="seconda" href="#">'
+
'<b>test</b>'
+
'</a>'
+
'<em></em>'
+
'</p>'
).
appendTo
(
"body"
),
filterit
=
function
(
sel
,
filter
,
length
)
{
equal
(
jQuery
(
sel
).
filter
(
filter
).
length
,
length
,
"jQuery( "
+
sel
+
" ).filter( "
+
filter
+
" )"
);
};
filterit
(
"#posp"
,
"#posp:first"
,
1
);
filterit
(
"#posp"
,
"#posp:eq(2)"
,
0
);
filterit
(
"#posp"
,
"#posp a:first"
,
0
);
// Keep in mind this is within the selection and
// not in relation to other elements (.is() is a different story)
filterit
(
"#posp .firsta"
,
"#posp a:first"
,
1
);
filterit
(
"#posp .firsta"
,
"#posp a:last"
,
1
);
filterit
(
"#posp .firsta"
,
"#posp a:last-child"
,
0
);
filterit
(
"#posp .firsta"
,
"#posp a:even"
,
1
);
filterit
(
"#posp .firsta"
,
"#posp a:odd"
,
0
);
filterit
(
"#posp .firsta"
,
"#posp a:eq(0)"
,
1
);
filterit
(
"#posp .firsta"
,
"#posp a:eq(9)"
,
0
);
filterit
(
"#posp .firsta"
,
"#posp em:eq(0)"
,
0
);
filterit
(
"#posp .firsta"
,
"#posp em:first"
,
0
);
filterit
(
"#posp .firsta"
,
"#posp:first"
,
0
);
filterit
(
"#posp .seconda"
,
"#posp a:first"
,
1
);
filterit
(
"#posp .seconda"
,
"#posp em:first"
,
0
);
filterit
(
"#posp .seconda"
,
"#posp a:last"
,
1
);
filterit
(
"#posp .seconda"
,
"#posp a:gt(0)"
,
0
);
filterit
(
"#posp .seconda"
,
"#posp a:lt(5)"
,
1
);
filterit
(
"#posp .seconda"
,
"#posp a:lt(1)"
,
1
);
html
.
remove
();
});
test
(
"index()"
,
function
()
{
test
(
"index()"
,
function
()
{
expect
(
2
);
expect
(
2
);
...
...
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