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
77d7f264
Commit
77d7f264
authored
Apr 17, 2013
by
Rick Waldron
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes #13779. Remove nodes in document order (uses for loop matching empty()).
parent
db0326b1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
2 deletions
+27
-2
manipulation.js
src/manipulation.js
+3
-2
manipulation.js
test/unit/manipulation.js
+24
-0
No files found.
src/manipulation.js
View file @
77d7f264
...
@@ -75,9 +75,10 @@ jQuery.fn.extend({
...
@@ -75,9 +75,10 @@ jQuery.fn.extend({
remove
:
function
(
selector
,
keepData
)
{
remove
:
function
(
selector
,
keepData
)
{
var
elem
,
var
elem
,
elems
=
selector
?
jQuery
.
filter
(
selector
,
this
)
:
this
,
elems
=
selector
?
jQuery
.
filter
(
selector
,
this
)
:
this
,
i
=
elems
.
length
;
i
=
0
,
l
=
elems
.
length
;
while
(
i
--
)
{
for
(
;
i
<
l
;
i
++
)
{
elem
=
elems
[
i
];
elem
=
elems
[
i
];
if
(
!
keepData
&&
elem
.
nodeType
===
1
)
{
if
(
!
keepData
&&
elem
.
nodeType
===
1
)
{
...
...
test/unit/manipulation.js
View file @
77d7f264
...
@@ -1572,6 +1572,30 @@ test( "remove() event cleaning ", 1, function() {
...
@@ -1572,6 +1572,30 @@ test( "remove() event cleaning ", 1, function() {
cleanUp
.
remove
();
cleanUp
.
remove
();
});
});
test
(
"remove() in document order #13779"
,
1
,
function
()
{
var
last
,
cleanData
=
jQuery
.
cleanData
;
jQuery
.
cleanData
=
function
(
nodes
)
{
last
=
nodes
[
0
].
textContent
;
cleanData
.
call
(
this
,
nodes
);
};
jQuery
(
"#qunit-fixture"
).
append
(
jQuery
.
parseHTML
(
"<div class='removal-fixture'>1</div>"
+
"<div class='removal-fixture'>2</div>"
+
"<div class='removal-fixture'>3</div>"
)
);
jQuery
(
".removal-fixture"
).
remove
();
equal
(
last
,
3
,
"The removal fixtures were removed in document order"
);
jQuery
.
cleanData
=
cleanData
;
});
test
(
"detach()"
,
11
,
function
()
{
test
(
"detach()"
,
11
,
function
()
{
testRemove
(
"detach"
);
testRemove
(
"detach"
);
});
});
...
...
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