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
551c2c9f
Commit
551c2c9f
authored
Dec 05, 2012
by
Rod Vagg
Committed by
Rick Waldron
Dec 05, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes #12449. make replaceWith() clone elements where required. Closes gh-920
parent
13449a99
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
128 additions
and
113 deletions
+128
-113
manipulation.js
src/manipulation.js
+17
-19
manipulation.js
test/unit/manipulation.js
+111
-94
No files found.
src/manipulation.js
View file @
551c2c9f
...
@@ -258,32 +258,29 @@ jQuery.fn.extend({
...
@@ -258,32 +258,29 @@ jQuery.fn.extend({
value
=
jQuery
(
value
).
detach
();
value
=
jQuery
(
value
).
detach
();
}
}
this
.
each
(
function
(
i
)
{
return
this
.
domManip
(
[
value
],
true
,
function
(
elem
,
i
)
{
var
next
=
this
.
nextSibling
,
var
next
,
parent
;
parent
=
this
.
parentNode
,
// HTML argument replaced by "this" element
// 1. There were no supporting tests
// 2. There was no internal code relying on this
// 3. There was no documentation of an html argument
val
=
!
isFunc
?
value
:
value
.
call
(
this
,
i
,
this
);
if
(
isDisconnected
(
this
)
)
{
if
(
isDisconnected
(
this
)
)
{
// for disconnected elements, we
replace with the new content in the set. We us
e
// for disconnected elements, we
simply replac
e
//
clone here to ensure that each replaced instance is unique
//
with the new content in the set
self
[
i
]
=
jQuery
(
val
).
clone
()[
0
]
;
self
[
i
]
=
elem
;
return
;
return
;
}
}
jQuery
(
this
).
remove
();
if
(
this
.
nodeType
===
1
||
this
.
nodeType
===
11
)
{
next
=
this
.
nextSibling
;
parent
=
this
.
parentNode
;
if
(
next
)
{
jQuery
(
this
).
remove
();
jQuery
(
next
).
before
(
val
);
}
else
{
if
(
next
)
{
jQuery
(
parent
).
append
(
val
);
next
.
parentNode
.
insertBefore
(
elem
,
next
);
}
else
{
parent
.
appendChild
(
elem
);
}
}
}
});
});
return
this
;
},
},
detach
:
function
(
selector
)
{
detach
:
function
(
selector
)
{
...
@@ -344,7 +341,8 @@ jQuery.fn.extend({
...
@@ -344,7 +341,8 @@ jQuery.fn.extend({
table
&&
jQuery
.
nodeName
(
this
[
i
],
"table"
)
?
table
&&
jQuery
.
nodeName
(
this
[
i
],
"table"
)
?
findOrAppend
(
this
[
i
],
"tbody"
)
:
findOrAppend
(
this
[
i
],
"tbody"
)
:
this
[
i
],
this
[
i
],
node
node
,
i
);
);
}
}
...
...
test/unit/manipulation.js
View file @
551c2c9f
This diff is collapsed.
Click to expand it.
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