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
5afc93c4
Commit
5afc93c4
authored
Dec 19, 2012
by
Oleg
Committed by
Dave Methvin
Dec 21, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix #13094. Pass index to .before(fn) fn as documented. Close gh-1093.
parent
96a349e4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
3 deletions
+12
-3
manipulation.js
src/manipulation.js
+4
-3
manipulation.js
test/unit/manipulation.js
+8
-0
No files found.
src/manipulation.js
View file @
5afc93c4
...
@@ -286,16 +286,17 @@ jQuery.fn.extend({
...
@@ -286,16 +286,17 @@ jQuery.fn.extend({
var
fragment
,
first
,
scripts
,
hasScripts
,
node
,
doc
,
var
fragment
,
first
,
scripts
,
hasScripts
,
node
,
doc
,
i
=
0
,
i
=
0
,
l
=
this
.
length
,
l
=
this
.
length
,
set
=
this
,
iNoClone
=
l
-
1
,
iNoClone
=
l
-
1
,
value
=
args
[
0
],
value
=
args
[
0
],
isFunction
=
jQuery
.
isFunction
(
value
);
isFunction
=
jQuery
.
isFunction
(
value
);
// We can't cloneNode fragments that contain checked, in WebKit
// We can't cloneNode fragments that contain checked, in WebKit
if
(
isFunction
||
!
(
l
<=
1
||
typeof
value
!==
"string"
||
jQuery
.
support
.
checkClone
||
!
rchecked
.
test
(
value
)
)
)
{
if
(
isFunction
||
!
(
l
<=
1
||
typeof
value
!==
"string"
||
jQuery
.
support
.
checkClone
||
!
rchecked
.
test
(
value
)
)
)
{
return
this
.
each
(
function
()
{
return
this
.
each
(
function
(
index
)
{
var
self
=
jQuery
(
this
);
var
self
=
set
.
eq
(
index
);
if
(
isFunction
)
{
if
(
isFunction
)
{
args
[
0
]
=
value
.
call
(
this
,
i
,
table
?
self
.
html
()
:
undefined
);
args
[
0
]
=
value
.
call
(
this
,
i
ndex
,
table
?
self
.
html
()
:
undefined
);
}
}
self
.
domManip
(
args
,
table
,
callback
);
self
.
domManip
(
args
,
table
,
callback
);
});
});
...
...
test/unit/manipulation.js
View file @
5afc93c4
...
@@ -2238,3 +2238,11 @@ test( "insertAfter, insertBefore, etc do not work when destination is original e
...
@@ -2238,3 +2238,11 @@ test( "insertAfter, insertBefore, etc do not work when destination is original e
jQuery
(
"#test4087-multiple"
).
remove
();
jQuery
(
"#test4087-multiple"
).
remove
();
});
});
});
});
test
(
"Index for function argument should be received (#13094)"
,
2
,
function
()
{
var
i
=
0
;
jQuery
(
"<div/><div/>"
).
before
(
function
(
index
)
{
equal
(
index
,
i
++
,
"Index should be correct"
);
});
});
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