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
5a6029c9
Commit
5a6029c9
authored
Jan 01, 2007
by
Jörn Zaefferer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added test and documentation for filter(Function)
parent
79f9678b
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
2 deletions
+24
-2
coreTest.js
src/jquery/coreTest.js
+1
-0
jquery.js
src/jquery/jquery.js
+23
-2
No files found.
src/jquery/coreTest.js
View file @
5a6029c9
...
@@ -261,6 +261,7 @@ test("clone()", function() {
...
@@ -261,6 +261,7 @@ test("clone()", function() {
test
(
"filter()"
,
function
()
{
test
(
"filter()"
,
function
()
{
isSet
(
$
(
"input"
).
filter
(
":checked"
).
get
(),
q
(
"radio2"
,
"check1"
),
"filter(String)"
);
isSet
(
$
(
"input"
).
filter
(
":checked"
).
get
(),
q
(
"radio2"
,
"check1"
),
"filter(String)"
);
isSet
(
$
(
"p"
).
filter
([
"#ap"
,
"#sndp"
]).
get
(),
q
(
"ap"
,
"sndp"
),
"filter(Array<String>)"
);
isSet
(
$
(
"p"
).
filter
([
"#ap"
,
"#sndp"
]).
get
(),
q
(
"ap"
,
"sndp"
),
"filter(Array<String>)"
);
isSet
(
$
(
"p"
).
filter
(
function
(
el
)
{
return
!
$
(
"a"
,
el
).
length
}).
get
(),
q
(
"sndp"
,
"first"
),
"filter(Function)"
);
});
});
test
(
"not(String)"
,
function
()
{
test
(
"not(String)"
,
function
()
{
...
...
src/jquery/jquery.js
View file @
5a6029c9
...
@@ -852,7 +852,7 @@ jQuery.fn = jQuery.prototype = {
...
@@ -852,7 +852,7 @@ jQuery.fn = jQuery.prototype = {
*
*
* @example $("p").filter(".selected")
* @example $("p").filter(".selected")
* @before <p class="selected">Hello</p><p>How are you?</p>
* @before <p class="selected">Hello</p><p>How are you?</p>
* @result
$("p").filter(".selected") ==
[ <p class="selected">Hello</p> ]
* @result [ <p class="selected">Hello</p> ]
*
*
* @name filter
* @name filter
* @type jQuery
* @type jQuery
...
@@ -860,6 +860,27 @@ jQuery.fn = jQuery.prototype = {
...
@@ -860,6 +860,27 @@ jQuery.fn = jQuery.prototype = {
* @cat DOM/Traversing
* @cat DOM/Traversing
*/
*/
/**
* Removes all elements from the set of matched elements that do not
* pass the specified filter. This method is used to narrow down
* the results of a search.
*
* The elements to filter are passed as the first argument, their
* index inside the set as the second.
*
* @example $("p").filter(function(element, index) {
* return $("ol", element).length == 0;
* })
* @before <p><ol><li>Hello</li></ol></p><p>How are you?</p>
* @result [ <p>How are you?</p> ]
* @desc Remove all elements that have a child ol element
*
* @name filter
* @type jQuery
* @param Function filter A function to use for filtering
* @cat DOM/Traversing
*/
/**
/**
* Removes all elements from the set of matched elements that do not
* Removes all elements from the set of matched elements that do not
* match at least one of the expressions passed to the function. This
* match at least one of the expressions passed to the function. This
...
@@ -871,7 +892,7 @@ jQuery.fn = jQuery.prototype = {
...
@@ -871,7 +892,7 @@ jQuery.fn = jQuery.prototype = {
*
*
* @example $("p").filter([".selected", ":first"])
* @example $("p").filter([".selected", ":first"])
* @before <p>Hello</p><p>Hello Again</p><p class="selected">And Again</p>
* @before <p>Hello</p><p>Hello Again</p><p class="selected">And Again</p>
* @result
$("p").filter([".selected", ":first"]) ==
[ <p>Hello</p>, <p class="selected">And Again</p> ]
* @result [ <p>Hello</p>, <p class="selected">And Again</p> ]
*
*
* @name filter
* @name filter
* @type jQuery
* @type jQuery
...
...
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